aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_many_associations_test.rb
diff options
context:
space:
mode:
authorManoj <manoj.kumar@risingsuntech.net>2012-01-31 13:46:07 +0530
committerManoj <manoj.kumar@risingsuntech.net>2012-01-31 14:11:14 +0530
commit23074c81a5e0b1e08e2e6555053678e8d656f484 (patch)
treef61d967aea60bfeaa04699ce318d967c45d16b36 /activerecord/test/cases/associations/has_many_associations_test.rb
parent3053f52671164530b811238f86954cb96f6ebc16 (diff)
downloadrails-23074c81a5e0b1e08e2e6555053678e8d656f484.tar.gz
rails-23074c81a5e0b1e08e2e6555053678e8d656f484.tar.bz2
rails-23074c81a5e0b1e08e2e6555053678e8d656f484.zip
suggested fixes for :dependent => :restrict deprecation.
Diffstat (limited to 'activerecord/test/cases/associations/has_many_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb21
1 files changed, 5 insertions, 16 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index a710900054..8c7956406a 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -1170,7 +1170,7 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
assert !firm.errors.empty?
- assert_equal "Cannot delete record because dependent companies exist", firm.errors[:base].first
+ assert_equal "Cannot delete record because dependent company exists", firm.errors[:base].first
assert RestrictedFirm.exists?(:name => 'restrict')
assert firm.companies.exists?(:name => 'child')
ensure
@@ -1676,20 +1676,9 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
end
def test_building_has_many_association_with_restrict_dependency
- assert_deprecated do
- class_eval <<-EOF
- class RestrictedFirm < ActiveRecord::Base
- has_many :companies, :dependent => :restrict
- end
- EOF
- end
-
- assert_not_deprecated do
- class_eval <<-EOF
- class Firm < ActiveRecord::Base
- has_many :companies
- end
- EOF
- end
+ klass = Class.new(ActiveRecord::Base)
+
+ assert_deprecated { klass.has_many :companies, :dependent => :restrict }
+ assert_not_deprecated { klass.has_many :companies }
end
end