mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Test for #489
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@434 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
1ae630a404
commit
8b82c5042d
1 changed files with 8 additions and 1 deletions
|
@ -487,8 +487,10 @@ class HasManyAssociationsTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
class BelongsToAssociationsTest < Test::Unit::TestCase
|
||||
fixtures :accounts, :companies, :developers, :projects, :topics
|
||||
|
||||
def setup
|
||||
create_fixtures "accounts", "companies", "developers", "projects", "developers_projects", "topics"
|
||||
create_fixtures "developers_projects"
|
||||
@signals37 = Firm.find(1)
|
||||
end
|
||||
|
||||
|
@ -577,6 +579,11 @@ class BelongsToAssociationsTest < Test::Unit::TestCase
|
|||
assert_equal apple, final_cut.firm(true)
|
||||
end
|
||||
|
||||
def test_new_record_with_foreign_key_but_no_object
|
||||
c = Client.new("firm_id" => 1)
|
||||
assert_equal @first_firm, c.firm_with_basic_id
|
||||
end
|
||||
|
||||
def test_field_name_same_as_foreign_key
|
||||
computer = Computer.find 1
|
||||
assert_not_nil computer.developer, ":foreign key == attribute didn't lock up"
|
||||
|
|
Loading…
Reference in a new issue