diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2014-01-16 18:48:51 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2014-01-16 18:48:51 -0200 |
commit | 740cf33b5ee9156429e68c19fa0fcf78b0bef877 (patch) | |
tree | f0f0d08d13b6e20c9bcaa77cfc3f5b4a27b6bcd5 /activerecord | |
parent | 44e55510547f5aaea78f5f91b82dd3dc5e9bef54 (diff) | |
download | rails-740cf33b5ee9156429e68c19fa0fcf78b0bef877.tar.gz rails-740cf33b5ee9156429e68c19fa0fcf78b0bef877.tar.bz2 rails-740cf33b5ee9156429e68c19fa0fcf78b0bef877.zip |
Use minitest's skip rather than conditionals + early returns
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/associations/eager_singularization_test.rb | 85 |
1 files changed, 38 insertions, 47 deletions
diff --git a/activerecord/test/cases/associations/eager_singularization_test.rb b/activerecord/test/cases/associations/eager_singularization_test.rb index 2dee6845b0..e74c2ba3b0 100644 --- a/activerecord/test/cases/associations/eager_singularization_test.rb +++ b/activerecord/test/cases/associations/eager_singularization_test.rb @@ -50,47 +50,44 @@ class EagerSingularizationTest < ActiveRecord::TestCase end def setup - if ActiveRecord::Base.connection.supports_migrations? - ActiveRecord::Base.connection.create_table :viri do |t| - t.column :octopus_id, :integer - t.column :species, :string - end - ActiveRecord::Base.connection.create_table :octopi do |t| - t.column :species, :string - end - ActiveRecord::Base.connection.create_table :passes do |t| - t.column :bus_id, :integer - t.column :rides, :integer - end - ActiveRecord::Base.connection.create_table :buses do |t| - t.column :name, :string - end - ActiveRecord::Base.connection.create_table :crises_messes, :id => false do |t| - t.column :crisis_id, :integer - t.column :mess_id, :integer - end - ActiveRecord::Base.connection.create_table :messes do |t| - t.column :name, :string - end - ActiveRecord::Base.connection.create_table :crises do |t| - t.column :name, :string - end - ActiveRecord::Base.connection.create_table :successes do |t| - t.column :name, :string - end - ActiveRecord::Base.connection.create_table :analyses do |t| - t.column :crisis_id, :integer - t.column :success_id, :integer - end - ActiveRecord::Base.connection.create_table :dresses do |t| - t.column :crisis_id, :integer - end - ActiveRecord::Base.connection.create_table :compresses do |t| - t.column :dress_id, :integer - end - @have_tables = true - else - @have_tables = false + skip 'Does not support migrations' unless ActiveRecord::Base.connection.supports_migrations? + + ActiveRecord::Base.connection.create_table :viri do |t| + t.column :octopus_id, :integer + t.column :species, :string + end + ActiveRecord::Base.connection.create_table :octopi do |t| + t.column :species, :string + end + ActiveRecord::Base.connection.create_table :passes do |t| + t.column :bus_id, :integer + t.column :rides, :integer + end + ActiveRecord::Base.connection.create_table :buses do |t| + t.column :name, :string + end + ActiveRecord::Base.connection.create_table :crises_messes, :id => false do |t| + t.column :crisis_id, :integer + t.column :mess_id, :integer + end + ActiveRecord::Base.connection.create_table :messes do |t| + t.column :name, :string + end + ActiveRecord::Base.connection.create_table :crises do |t| + t.column :name, :string + end + ActiveRecord::Base.connection.create_table :successes do |t| + t.column :name, :string + end + ActiveRecord::Base.connection.create_table :analyses do |t| + t.column :crisis_id, :integer + t.column :success_id, :integer + end + ActiveRecord::Base.connection.create_table :dresses do |t| + t.column :crisis_id, :integer + end + ActiveRecord::Base.connection.create_table :compresses do |t| + t.column :dress_id, :integer end end @@ -109,28 +106,24 @@ class EagerSingularizationTest < ActiveRecord::TestCase end def test_eager_no_extra_singularization_belongs_to - return unless @have_tables assert_nothing_raised do Virus.all.merge!(:includes => :octopus).to_a end end def test_eager_no_extra_singularization_has_one - return unless @have_tables assert_nothing_raised do Octopus.all.merge!(:includes => :virus).to_a end end def test_eager_no_extra_singularization_has_many - return unless @have_tables assert_nothing_raised do Bus.all.merge!(:includes => :passes).to_a end end def test_eager_no_extra_singularization_has_and_belongs_to_many - return unless @have_tables assert_nothing_raised do Crisis.all.merge!(:includes => :messes).to_a Mess.all.merge!(:includes => :crises).to_a @@ -138,14 +131,12 @@ class EagerSingularizationTest < ActiveRecord::TestCase end def test_eager_no_extra_singularization_has_many_through_belongs_to - return unless @have_tables assert_nothing_raised do Crisis.all.merge!(:includes => :successes).to_a end end def test_eager_no_extra_singularization_has_many_through_has_many - return unless @have_tables assert_nothing_raised do Crisis.all.merge!(:includes => :compresses).to_a end |