Use try in tests that try to test try.

This commit is contained in:
Kasper Timm Hansen 2018-03-21 21:02:36 +01:00
parent 958c5ad9e9
commit 242ae67ebe
No known key found for this signature in database
GPG Key ID: 191153215EDA53D8
1 changed files with 2 additions and 7 deletions

View File

@ -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