From 3064f4a4ac43e8cd40bc1a7ec1786b9f265ea650 Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Wed, 15 Apr 2015 21:50:33 -0400 Subject: [PATCH] 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. --- .travis.yml | 1 + Appraisals | 4 ++ gemfiles/4.2.gemfile | 10 ++++ gemfiles/4.2.gemfile.lock | 95 +++++++++++++++++++++++++++++++ spec/acceptance/callbacks_spec.rb | 10 ++-- 5 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 gemfiles/4.2.gemfile create mode 100644 gemfiles/4.2.gemfile.lock diff --git a/.travis.yml b/.travis.yml index 30be1a7..18f6c8b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ gemfile: - gemfiles/3.2.gemfile - gemfiles/4.0.gemfile - gemfiles/4.1.gemfile + - gemfiles/4.2.gemfile branches: only: - master diff --git a/Appraisals b/Appraisals index b7a728a..15d3e08 100644 --- a/Appraisals +++ b/Appraisals @@ -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 diff --git a/gemfiles/4.2.gemfile b/gemfiles/4.2.gemfile new file mode 100644 index 0000000..65fcb6b --- /dev/null +++ b/gemfiles/4.2.gemfile @@ -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 => "../" diff --git a/gemfiles/4.2.gemfile.lock b/gemfiles/4.2.gemfile.lock new file mode 100644 index 0000000..b34282d --- /dev/null +++ b/gemfiles/4.2.gemfile.lock @@ -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 diff --git a/spec/acceptance/callbacks_spec.rb b/spec/acceptance/callbacks_spec.rb index 7f9995e..13e4c3a 100644 --- a/spec/acceptance/callbacks_spec.rb +++ b/spec/acceptance/callbacks_spec.rb @@ -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