diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2014-01-16 18:52:43 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2014-01-16 18:52:43 -0200 |
commit | 49223c9bc9bab1d827e98763ee49892b8c4faa72 (patch) | |
tree | b05f15a4ee32a6003c02d0c4f680ceabaa1535ec /activerecord | |
parent | 740cf33b5ee9156429e68c19fa0fcf78b0bef877 (diff) | |
download | rails-49223c9bc9bab1d827e98763ee49892b8c4faa72.tar.gz rails-49223c9bc9bab1d827e98763ee49892b8c4faa72.tar.bz2 rails-49223c9bc9bab1d827e98763ee49892b8c4faa72.zip |
Extract a method to simplify setup code
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/associations/eager_singularization_test.rb | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/activerecord/test/cases/associations/eager_singularization_test.rb b/activerecord/test/cases/associations/eager_singularization_test.rb index e74c2ba3b0..669569a774 100644 --- a/activerecord/test/cases/associations/eager_singularization_test.rb +++ b/activerecord/test/cases/associations/eager_singularization_test.rb @@ -50,59 +50,63 @@ class EagerSingularizationTest < ActiveRecord::TestCase end def setup - skip 'Does not support migrations' unless ActiveRecord::Base.connection.supports_migrations? + skip 'Does not support migrations' unless connection.supports_migrations? - ActiveRecord::Base.connection.create_table :viri do |t| + connection.create_table :viri do |t| t.column :octopus_id, :integer t.column :species, :string end - ActiveRecord::Base.connection.create_table :octopi do |t| + connection.create_table :octopi do |t| t.column :species, :string end - ActiveRecord::Base.connection.create_table :passes do |t| + connection.create_table :passes do |t| t.column :bus_id, :integer t.column :rides, :integer end - ActiveRecord::Base.connection.create_table :buses do |t| + connection.create_table :buses do |t| t.column :name, :string end - ActiveRecord::Base.connection.create_table :crises_messes, :id => false do |t| + 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| + connection.create_table :messes do |t| t.column :name, :string end - ActiveRecord::Base.connection.create_table :crises do |t| + connection.create_table :crises do |t| t.column :name, :string end - ActiveRecord::Base.connection.create_table :successes do |t| + connection.create_table :successes do |t| t.column :name, :string end - ActiveRecord::Base.connection.create_table :analyses do |t| + 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| + connection.create_table :dresses do |t| t.column :crisis_id, :integer end - ActiveRecord::Base.connection.create_table :compresses do |t| + connection.create_table :compresses do |t| t.column :dress_id, :integer end end def teardown - ActiveRecord::Base.connection.drop_table :viri - ActiveRecord::Base.connection.drop_table :octopi - ActiveRecord::Base.connection.drop_table :passes - ActiveRecord::Base.connection.drop_table :buses - ActiveRecord::Base.connection.drop_table :crises_messes - ActiveRecord::Base.connection.drop_table :messes - ActiveRecord::Base.connection.drop_table :crises - ActiveRecord::Base.connection.drop_table :successes - ActiveRecord::Base.connection.drop_table :analyses - ActiveRecord::Base.connection.drop_table :dresses - ActiveRecord::Base.connection.drop_table :compresses + connection.drop_table :viri + connection.drop_table :octopi + connection.drop_table :passes + connection.drop_table :buses + connection.drop_table :crises_messes + connection.drop_table :messes + connection.drop_table :crises + connection.drop_table :successes + connection.drop_table :analyses + connection.drop_table :dresses + connection.drop_table :compresses + end + + def connection + ActiveRecord::Base.connection end def test_eager_no_extra_singularization_belongs_to |