Test against Rails 4.2

* Update callbacks spec so column types reflect assignment

  Rails 4.2 introduces type coercion on attribute assignment instead of it
  occurring after persisting the record.
This commit is contained in:
Joshua Clayton 2015-04-15 21:50:33 -04:00
parent 948238f71a
commit 3064f4a4ac
5 changed files with 115 additions and 5 deletions

View File

@ -14,6 +14,7 @@ gemfile:
- gemfiles/3.2.gemfile
- gemfiles/4.0.gemfile
- gemfiles/4.1.gemfile
- gemfiles/4.2.gemfile
branches:
only:
- master

View File

@ -9,3 +9,7 @@ end
appraise '4.1' do
gem 'activerecord', "~> 4.1.1"
end
appraise '4.2' do
gem 'activerecord', "~> 4.2.1"
end

10
gemfiles/4.2.gemfile Normal file
View File

@ -0,0 +1,10 @@
# This file was generated by Appraisal
source "https://rubygems.org"
gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
gem "jdbc-sqlite3", :platforms => :jruby
gem "sqlite3", "~> 1.3.10", :platforms => :ruby
gem "activerecord", "~> 4.2.1"
gemspec :path => "../"

95
gemfiles/4.2.gemfile.lock Normal file
View File

@ -0,0 +1,95 @@
PATH
remote: ../
specs:
factory_girl (4.5.0)
activesupport (>= 3.0.0)
GEM
remote: https://rubygems.org/
specs:
activemodel (4.2.1)
activesupport (= 4.2.1)
builder (~> 3.1)
activerecord (4.2.1)
activemodel (= 4.2.1)
activesupport (= 4.2.1)
arel (~> 6.0)
activesupport (4.2.1)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
appraisal (1.0.3)
bundler
rake
thor (>= 0.14.0)
arel (6.0.0)
aruba (0.6.2)
childprocess (>= 0.3.6)
cucumber (>= 1.1.1)
rspec-expectations (>= 2.7.0)
bourne (1.6.0)
mocha (~> 1.1)
builder (3.2.2)
childprocess (0.5.6)
ffi (~> 1.0, >= 1.0.11)
cucumber (1.3.19)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.12)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.2)
diff-lcs (1.1.3)
docile (1.1.5)
ffi (1.9.8)
gherkin (2.12.2)
multi_json (~> 1.3)
i18n (0.7.0)
json (1.8.2)
metaclass (0.0.4)
minitest (5.6.0)
mocha (1.1.0)
metaclass (~> 0.0.1)
multi_json (1.11.0)
multi_test (0.1.2)
rake (10.4.2)
rspec (2.12.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.2)
simplecov (0.9.2)
docile (~> 1.1.0)
multi_json (~> 1.0)
simplecov-html (~> 0.9.0)
simplecov-html (0.9.0)
sqlite3 (1.3.10)
thor (0.19.1)
thread_safe (0.3.5)
timecop (0.7.3)
tzinfo (1.2.2)
thread_safe (~> 0.1)
yard (0.8.7.6)
PLATFORMS
ruby
DEPENDENCIES
activerecord (~> 4.2.1)
activerecord-jdbcsqlite3-adapter
appraisal (~> 1.0.0)
aruba
bourne
cucumber (~> 1.3.15)
factory_girl!
jdbc-sqlite3
mocha (>= 0.12.8)
rspec (~> 2.12.0)
simplecov
sqlite3 (~> 1.3.10)
timecop
yard

View File

@ -73,7 +73,7 @@ end
describe "callbacks using syntax methods without referencing FactoryGirl explicitly" do
before do
define_model("User", first_name: :string, last_name: :string)
define_model("User", first_number: :integer, last_number: :integer)
FactoryGirl.define do
sequence(:sequence_1)
@ -82,8 +82,8 @@ describe "callbacks using syntax methods without referencing FactoryGirl explici
factory :user do
after(:stub) { generate(:sequence_3) }
after(:build) { |user| user.first_name = generate(:sequence_1) }
after(:create) { |user, evaluator| user.last_name = generate(:sequence_2) }
after(:build) { |user| user.first_number = generate(:sequence_1) }
after(:create) { |user, evaluator| user.last_number = generate(:sequence_2) }
end
end
end
@ -94,11 +94,11 @@ describe "callbacks using syntax methods without referencing FactoryGirl explici
end
it "works when the callback has one variable" do
expect(FactoryGirl.build(:user).first_name).to eq 1
expect(FactoryGirl.build(:user).first_number).to eq 1
end
it "works when the callback has two variables" do
expect(FactoryGirl.create(:user).last_name).to eq 1
expect(FactoryGirl.create(:user).last_number).to eq 1
end
end