mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Refactoring test_has_many_with_pluralize_table_names_false test
This commit is contained in:
parent
6a3b3fba5a
commit
23e94a67f8
2 changed files with 2 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
class Aircraft < ActiveRecord::Base
|
||||
self.pluralize_table_names = false
|
||||
has_many :engines, :foreign_key => "car_id"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue