mirror of https://github.com/rails/rails
Use try in tests that try to test try.
This commit is contained in:
parent
958c5ad9e9
commit
242ae67ebe
|
@ -78,7 +78,6 @@ class ObjectTryTest < ActiveSupport::TestCase
|
|||
def test_try_with_private_method_bang
|
||||
klass = Class.new do
|
||||
private
|
||||
|
||||
def private_method
|
||||
"private method"
|
||||
end
|
||||
|
@ -90,7 +89,6 @@ class ObjectTryTest < ActiveSupport::TestCase
|
|||
def test_try_with_private_method
|
||||
klass = Class.new do
|
||||
private
|
||||
|
||||
def private_method
|
||||
"private method"
|
||||
end
|
||||
|
@ -109,7 +107,6 @@ class ObjectTryTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
private
|
||||
|
||||
def private_delegator_method
|
||||
"private delegator method"
|
||||
end
|
||||
|
@ -120,11 +117,11 @@ class ObjectTryTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_try_with_method_on_delegator_target
|
||||
assert_equal 5, Decorator.new(@string).size
|
||||
assert_equal 5, Decorator.new(@string).try(:size)
|
||||
end
|
||||
|
||||
def test_try_with_overridden_method_on_delegator
|
||||
assert_equal "overridden reverse", Decorator.new(@string).reverse
|
||||
assert_equal "overridden reverse", Decorator.new(@string).try(:reverse)
|
||||
end
|
||||
|
||||
def test_try_with_private_method_on_delegator
|
||||
|
@ -140,7 +137,6 @@ class ObjectTryTest < ActiveSupport::TestCase
|
|||
def test_try_with_private_method_on_delegator_target
|
||||
klass = Class.new do
|
||||
private
|
||||
|
||||
def private_method
|
||||
"private method"
|
||||
end
|
||||
|
@ -152,7 +148,6 @@ class ObjectTryTest < ActiveSupport::TestCase
|
|||
def test_try_with_private_method_on_delegator_target_bang
|
||||
klass = Class.new do
|
||||
private
|
||||
|
||||
def private_method
|
||||
"private method"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue