diff options
author | David Chelimsky <dchelimsky@gmail.com> | 2010-11-07 08:05:18 -0600 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-11-09 13:54:04 -0200 |
commit | 1f06652a57e727700c3a673dc1f86e3b1e07ce1f (patch) | |
tree | 6ab5165939c2fcae615bd586ea0254e352f6715a /activerecord/test/cases/associations/belongs_to_associations_test.rb | |
parent | f57b5197b3215d9dd66196e960ef5d78b7a62de1 (diff) | |
download | rails-1f06652a57e727700c3a673dc1f86e3b1e07ce1f.tar.gz rails-1f06652a57e727700c3a673dc1f86e3b1e07ce1f.tar.bz2 rails-1f06652a57e727700c3a673dc1f86e3b1e07ce1f.zip |
use persisted? instead of new_record? wherever possible
- persisted? is the API defined in ActiveModel
- makes it easier for extension libraries to conform to ActiveModel APIs
without concern for whether the extended object is specifically
ActiveRecord
[#5927 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activerecord/test/cases/associations/belongs_to_associations_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/belongs_to_associations_test.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index 0fa4328826..1b0c00bd5a 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -285,10 +285,10 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase final_cut = Client.new("name" => "Final Cut") firm = Firm.find(1) final_cut.firm = firm - assert final_cut.new_record? + assert !final_cut.persisted? assert final_cut.save - assert !final_cut.new_record? - assert !firm.new_record? + assert final_cut.persisted? + assert firm.persisted? assert_equal firm, final_cut.firm assert_equal firm, final_cut.firm(true) end @@ -297,10 +297,10 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase final_cut = Client.new("name" => "Final Cut") firm = Firm.find(1) final_cut.firm_with_primary_key = firm - assert final_cut.new_record? + assert !final_cut.persisted? assert final_cut.save - assert !final_cut.new_record? - assert !firm.new_record? + assert final_cut.persisted? + assert firm.persisted? assert_equal firm, final_cut.firm_with_primary_key assert_equal firm, final_cut.firm_with_primary_key(true) end |