mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Let's simplify the internal assertion here, doesn't need to a yield argument
This commit is contained in:
parent
b19cd20f63
commit
32a69da269
1 changed files with 7 additions and 12 deletions
|
@ -46,15 +46,10 @@ class ExcludingTest < ActiveRecord::TestCase
|
|||
end
|
||||
|
||||
def test_does_not_exclude_records_when_no_arguments
|
||||
assert_does_not_exclude_records { Post.excluding() }
|
||||
end
|
||||
|
||||
def test_does_not_exclude_records_with_empty_collection_argument
|
||||
assert_does_not_exclude_records { Post.excluding([]) }
|
||||
end
|
||||
|
||||
def test_does_not_exclude_records_with_a_nil_argument
|
||||
assert_does_not_exclude_records { Post.excluding(nil) }
|
||||
assert_no_excludes Post.excluding
|
||||
assert_no_excludes Post.excluding(nil)
|
||||
assert_no_excludes Post.excluding([])
|
||||
assert_no_excludes Post.excluding([ nil ])
|
||||
end
|
||||
|
||||
def test_raises_on_record_from_different_class
|
||||
|
@ -74,8 +69,8 @@ class ExcludingTest < ActiveRecord::TestCase
|
|||
end
|
||||
|
||||
private
|
||||
def assert_does_not_exclude_records
|
||||
assert_includes yield, posts(:welcome)
|
||||
assert_equal Post.count, yield.count
|
||||
def assert_no_excludes(relation)
|
||||
assert_includes relation, posts(:welcome)
|
||||
assert_equal Post.count, relation.count
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue