From 23e94a67f8e922a9ccde7f8b2e6abc56a925d6bf Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Fri, 20 May 2011 01:53:13 -0500 Subject: [PATCH] Refactoring test_has_many_with_pluralize_table_names_false test --- activerecord/test/cases/associations/join_model_test.rb | 5 +---- activerecord/test/models/aircraft.rb | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb index 8e23ab78be..b59ce4efeb 100644 --- a/activerecord/test/cases/associations/join_model_test.rb +++ b/activerecord/test/cases/associations/join_model_test.rb @@ -708,12 +708,9 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase end def test_has_many_with_pluralize_table_names_false - engine = Engine.create(:car_id => 1) - Aircraft.pluralize_table_names = false + engine = Engine.create!(:car_id => 1) aircraft = Aircraft.create!(:name => "Airbus 380", :id => 1) assert_equal aircraft.engines, [engine] - ensure - ActiveRecord::Base.pluralize_table_names = true end private diff --git a/activerecord/test/models/aircraft.rb b/activerecord/test/models/aircraft.rb index 0c47aab539..1f35ef45da 100644 --- a/activerecord/test/models/aircraft.rb +++ b/activerecord/test/models/aircraft.rb @@ -1,3 +1,4 @@ class Aircraft < ActiveRecord::Base + self.pluralize_table_names = false has_many :engines, :foreign_key => "car_id" end