aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2011-05-20 01:53:13 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2011-05-20 01:53:13 -0500
commit23e94a67f8e922a9ccde7f8b2e6abc56a925d6bf (patch)
treedc3f5b7d5ac6980ab1ee8ad249d1116a54ad157d
parent6a3b3fba5a173dc8cd308c30426247e93e5fc97e (diff)
downloadrails-23e94a67f8e922a9ccde7f8b2e6abc56a925d6bf.tar.gz
rails-23e94a67f8e922a9ccde7f8b2e6abc56a925d6bf.tar.bz2
rails-23e94a67f8e922a9ccde7f8b2e6abc56a925d6bf.zip
Refactoring test_has_many_with_pluralize_table_names_false test
-rw-r--r--activerecord/test/cases/associations/join_model_test.rb5
-rw-r--r--activerecord/test/models/aircraft.rb1
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