diff options
author | Josh Kalderimis <josh.kalderimis@gmail.com> | 2011-04-28 18:46:26 +0200 |
---|---|---|
committer | Josh Kalderimis <josh.kalderimis@gmail.com> | 2011-04-28 18:46:40 +0200 |
commit | 5164c50d7ff42faa801e827dc8761ff11e61f3e2 (patch) | |
tree | 018275033ea24df6f16724768e035719e51dc0f6 /activerecord/test/cases/relation_scoping_test.rb | |
parent | bb44cd727ff4df0c6baac52ec008289626b874e9 (diff) | |
download | rails-5164c50d7ff42faa801e827dc8761ff11e61f3e2.tar.gz rails-5164c50d7ff42faa801e827dc8761ff11e61f3e2.tar.bz2 rails-5164c50d7ff42faa801e827dc8761ff11e61f3e2.zip |
removed the default_scope deprecations and updated the docs and tests to reflect its use cases
Diffstat (limited to 'activerecord/test/cases/relation_scoping_test.rb')
-rw-r--r-- | activerecord/test/cases/relation_scoping_test.rb | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/activerecord/test/cases/relation_scoping_test.rb b/activerecord/test/cases/relation_scoping_test.rb index 2ed676fe69..864b3d4846 100644 --- a/activerecord/test/cases/relation_scoping_test.rb +++ b/activerecord/test/cases/relation_scoping_test.rb @@ -355,6 +355,12 @@ class DefaultScopingTest < ActiveRecord::TestCase assert_equal 50000, wheres[:salary] end + def test_default_scope_with_module_includes + wheres = ModuleIncludedPoorDeveloperCalledJamis.scoped.where_values_hash + assert_equal "Jamis", wheres[:name] + assert_equal 50000, wheres[:salary] + end + def test_default_scope_with_multiple_calls wheres = MultiplePoorDeveloperCalledJamis.scoped.where_values_hash assert_equal "Jamis", wheres[:name] @@ -456,18 +462,4 @@ class DefaultScopingTest < ActiveRecord::TestCase assert DeveloperCalledJamis.unscoped.poor.include?(developers(:david).becomes(DeveloperCalledJamis)) assert_equal 10, DeveloperCalledJamis.unscoped.poor.length end - - def test_multiple_default_scope_calls_are_deprecated - klass = Class.new(ActiveRecord::Base) - - assert_not_deprecated do - klass.send(:default_scope, :foo => :bar) - end - - assert_deprecated do - klass.send(:default_scope, :foo => :bar) - end - - assert_equal 2, klass.default_scopes.length - end end |