diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-04-05 14:48:49 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-04-05 14:48:49 -0700 |
commit | 01034d3be0d7c8c09b551ac612c4b18f86086dc5 (patch) | |
tree | 3d5d590d6459f2f3a9ad0b15f08169babcce428c /activerecord/test/cases/associations/inverse_associations_test.rb | |
parent | c037659294555298889a7102c580240804f44d84 (diff) | |
parent | 096ee1594d329f53ef47d0aff9bb6eef25a18b96 (diff) | |
download | rails-01034d3be0d7c8c09b551ac612c4b18f86086dc5.tar.gz rails-01034d3be0d7c8c09b551ac612c4b18f86086dc5.tar.bz2 rails-01034d3be0d7c8c09b551ac612c4b18f86086dc5.zip |
Merge branch 'master' into railstest
* master: (44 commits)
Improve the changelog entry [ci skip]
Fix explicit names on multiple file fields
Correctly parse bigint defaults in PostgreSQL
Move changelog to the top [ci skip]
Fix indent and remove extra white spaces
Fix scope chaining + STI
failing test for #9869
Improve `belongs_to touch: true` timestamp test
Sort modules in alphabetical order.
Avoid an attempt to fetch old record when id was not present in touch callback
Use the correct pk field from the reflected class to find the old record
Refactor mail_to to not generate intermediate hashes when adding href
Ensure mail_to helper does not modify the given html options hash
Use inspect when writing the foreign key from the reflection
Use a space after the comment sign when showing the result of commands
Exclude template files for rdoc API [ci skip]
template should have generic name
use | to have more intent revealing code
Revert "Merge pull request #10034 from benofsky/fix_skipping_object_callback_filters"
stop depending on callbacks
...
Conflicts:
railties/test/application/rake_test.rb
Diffstat (limited to 'activerecord/test/cases/associations/inverse_associations_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/inverse_associations_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/inverse_associations_test.rb b/activerecord/test/cases/associations/inverse_associations_test.rb index 85d0ad0aa1..ec128acf28 100644 --- a/activerecord/test/cases/associations/inverse_associations_test.rb +++ b/activerecord/test/cases/associations/inverse_associations_test.rb @@ -235,6 +235,22 @@ class InverseHasManyTests < ActiveRecord::TestCase assert_equal m.name, i.man.name, "Name of man should be the same after changes to newly-created-child-owned instance" end + def test_parent_instance_should_be_shared_within_create_block_of_new_child + man = Man.first + interest = man.interests.build do |i| + assert i.man.equal?(man), "Man of child should be the same instance as a parent" + end + assert interest.man.equal?(man), "Man of the child should still be the same instance as a parent" + end + + def test_parent_instance_should_be_shared_within_build_block_of_new_child + man = Man.first + interest = man.interests.build do |i| + assert i.man.equal?(man), "Man of child should be the same instance as a parent" + end + assert interest.man.equal?(man), "Man of the child should still be the same instance as a parent" + end + def test_parent_instance_should_be_shared_with_poked_in_child m = men(:gordon) i = Interest.create(:topic => 'Industrial Revolution Re-enactment') |