2013-07-11 03:00:06 +00:00
|
|
|
# Responsability
|
|
|
|
# Test whether rails version > 4
|
|
|
|
# includes attr_accessible if < 4
|
2013-07-12 01:48:23 +00:00
|
|
|
require 'minitest_helper'
|
2013-07-11 03:09:58 +00:00
|
|
|
require 'impressionist/rails_toggle'
|
|
|
|
|
|
|
|
module Impressionist
|
|
|
|
describe RailsToggle do
|
|
|
|
|
2013-07-12 01:48:23 +00:00
|
|
|
before {
|
|
|
|
@toggle = RailsToggle.new
|
|
|
|
}
|
2013-07-11 04:43:04 +00:00
|
|
|
|
2013-07-12 01:48:23 +00:00
|
|
|
describe "Rails 4" do
|
2013-07-11 04:43:04 +00:00
|
|
|
|
2013-07-12 01:48:23 +00:00
|
|
|
# see your_minitest_path/lib/minitest/mock.rb
|
|
|
|
it "must not include attr_accessible" do
|
2013-09-22 17:54:25 +00:00
|
|
|
@toggle.stub :supported_by_rails?, false do
|
2013-07-12 01:48:23 +00:00
|
|
|
refute @toggle.should_include?
|
|
|
|
end
|
2013-07-11 04:43:04 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2013-09-22 17:54:25 +00:00
|
|
|
describe "Strong Parameters" do
|
|
|
|
|
|
|
|
# see your_minitest_path/lib/minitest/mock.rb
|
|
|
|
it "must not include attr_accessible" do
|
|
|
|
@toggle.stub :supported_by_rails?, true do
|
|
|
|
@toggle.stub :using_strong_parameters?, true do
|
|
|
|
refute @toggle.should_include?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2013-07-11 03:09:58 +00:00
|
|
|
end
|
|
|
|
end
|