mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add test cases for #in? and #presence_in
This commit is contained in:
parent
3681e1ac2c
commit
f648195247
1 changed files with 4 additions and 0 deletions
|
@ -37,11 +37,14 @@ class InTest < ActiveSupport::TestCase
|
|||
end
|
||||
class C < B
|
||||
end
|
||||
class D
|
||||
end
|
||||
|
||||
def test_in_module
|
||||
assert A.in?(B)
|
||||
assert A.in?(C)
|
||||
assert !A.in?(A)
|
||||
assert !A.in?(D)
|
||||
end
|
||||
|
||||
def test_no_method_catching
|
||||
|
@ -51,5 +54,6 @@ class InTest < ActiveSupport::TestCase
|
|||
def test_presence_in
|
||||
assert_equal "stuff", "stuff".presence_in(%w( lots of stuff ))
|
||||
assert_nil "stuff".presence_in(%w( lots of crap ))
|
||||
assert_raise(ArgumentError) { 1.presence_in(1) }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue