0
@@ -92,7 +92,7 @@ class ParanoidTest < Test::Unit::TestCase
0
def test_should_not_count_deleted
0
assert_equal 1, Widget.count
0
- assert_equal 1, Widget.count(
['title=?', 'widget 1'])
0
+ assert_equal 1, Widget.count(
:all, :conditions => ['title=?', 'widget 1'])
0
assert_equal 2, Widget.calculate_with_deleted(:count, :all)
0
@@ -142,19 +142,19 @@ class ParanoidTest < Test::Unit::TestCase
0
def test_should_not_override_scopes_when_counting
0
- assert_equal 1, Widget.with_scope(:find => { :conditions => "title = 'widget 1'" }) { Widget.count }
0
- assert_equal 0, Widget.with_scope(:find => { :conditions => "title = 'deleted widget 2'" }) { Widget.count }
0
- assert_equal 1, Widget.with_scope(:find => { :conditions => "title = 'deleted widget 2'" }) { Widget.calculate_with_deleted(:count, :all) }
0
+ assert_equal 1, Widget.send(:with_scope, :find => { :conditions => "title = 'widget 1'" }) { Widget.count }
0
+ assert_equal 0, Widget.send(:with_scope, :find => { :conditions => "title = 'deleted widget 2'" }) { Widget.count }
0
+ assert_equal 1, Widget.send(:with_scope, :find => { :conditions => "title = 'deleted widget 2'" }) { Widget.calculate_with_deleted(:count, :all) }
0
def test_should_not_override_scopes_when_finding
0
- assert_equal [1], Widget.with_scope(:find => { :conditions => "title = 'widget 1'" }) { Widget.find(:all) }.ids
0
- assert_equal [], Widget.with_scope(:find => { :conditions => "title = 'deleted widget 2'" }) { Widget.find(:all) }.ids
0
- assert_equal [2], Widget.with_scope(:find => { :conditions => "title = 'deleted widget 2'" }) { Widget.find_with_deleted(:all) }.ids
0
+ assert_equal [1], Widget.send(:with_scope, :find => { :conditions => "title = 'widget 1'" }) { Widget.find(:all) }.ids
0
+ assert_equal [], Widget.send(:with_scope, :find => { :conditions => "title = 'deleted widget 2'" }) { Widget.find(:all) }.ids
0
+ assert_equal [2], Widget.send(:with_scope, :find => { :conditions => "title = 'deleted widget 2'" }) { Widget.find_with_deleted(:all) }.ids
0
def test_should_allow_multiple_scoped_calls_when_finding
0
- Widget.
with_scope(:find => { :conditions => "title = 'deleted widget 2'" }) do
0
+ Widget.
send(:with_scope, :find => { :conditions => "title = 'deleted widget 2'" }) do
0
assert_equal [2], Widget.find_with_deleted(:all).ids
0
assert_equal [2], Widget.find_with_deleted(:all).ids, "clobbers the constrain on the unmodified find"
0
assert_equal [], Widget.find(:all).ids
0
@@ -163,7 +163,7 @@ class ParanoidTest < Test::Unit::TestCase
0
def test_should_allow_multiple_scoped_calls_when_counting
0
- Widget.
with_scope(:find => { :conditions => "title = 'deleted widget 2'" }) do
0
+ Widget.
send(:with_scope, :find => { :conditions => "title = 'deleted widget 2'" }) do
0
assert_equal 1, Widget.calculate_with_deleted(:count, :all)
0
assert_equal 1, Widget.calculate_with_deleted(:count, :all), "clobbers the constrain on the unmodified find"
0
assert_equal 0, Widget.count
Comments
No one has commented yet.