Skip to content

Commit fa2af42

Browse files
committed
Proc always respond_to :binding
1 parent 2eb4ebe commit fa2af42

File tree

1 file changed

+39
-43
lines changed

1 file changed

+39
-43
lines changed

activesupport/test/test_test.rb

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15,68 +15,64 @@ def decrement
1515
@object.num = 0
1616
end
1717

18-
if lambda { }.respond_to?(:binding)
19-
def test_assert_no_difference
20-
assert_no_difference '@object.num' do
21-
# ...
22-
end
18+
def test_assert_no_difference
19+
assert_no_difference '@object.num' do
20+
# ...
2321
end
22+
end
2423

25-
def test_assert_difference
26-
assert_difference '@object.num', +1 do
27-
@object.increment
28-
end
24+
def test_assert_difference
25+
assert_difference '@object.num', +1 do
26+
@object.increment
2927
end
28+
end
3029

31-
def test_assert_difference_with_implicit_difference
32-
assert_difference '@object.num' do
33-
@object.increment
34-
end
30+
def test_assert_difference_with_implicit_difference
31+
assert_difference '@object.num' do
32+
@object.increment
3533
end
34+
end
3635

37-
def test_arbitrary_expression
38-
assert_difference '@object.num + 1', +2 do
39-
@object.increment
40-
@object.increment
41-
end
36+
def test_arbitrary_expression
37+
assert_difference '@object.num + 1', +2 do
38+
@object.increment
39+
@object.increment
4240
end
41+
end
4342

44-
def test_negative_differences
45-
assert_difference '@object.num', -1 do
46-
@object.decrement
47-
end
43+
def test_negative_differences
44+
assert_difference '@object.num', -1 do
45+
@object.decrement
4846
end
47+
end
4948

50-
def test_expression_is_evaluated_in_the_appropriate_scope
51-
silence_warnings do
52-
local_scope = local_scope = 'foo'
53-
assert_difference('local_scope; @object.num') { @object.increment }
54-
end
49+
def test_expression_is_evaluated_in_the_appropriate_scope
50+
silence_warnings do
51+
local_scope = local_scope = 'foo'
52+
assert_difference('local_scope; @object.num') { @object.increment }
5553
end
54+
end
5655

57-
def test_array_of_expressions
58-
assert_difference [ '@object.num', '@object.num + 1' ], +1 do
59-
@object.increment
60-
end
56+
def test_array_of_expressions
57+
assert_difference [ '@object.num', '@object.num + 1' ], +1 do
58+
@object.increment
6159
end
60+
end
6261

63-
def test_array_of_expressions_identify_failure
64-
assert_raises(MiniTest::Assertion) do
65-
assert_difference ['@object.num', '1 + 1'] do
66-
@object.increment
67-
end
62+
def test_array_of_expressions_identify_failure
63+
assert_raises(MiniTest::Assertion) do
64+
assert_difference ['@object.num', '1 + 1'] do
65+
@object.increment
6866
end
6967
end
68+
end
7069

71-
def test_array_of_expressions_identify_failure_when_message_provided
72-
assert_raises(MiniTest::Assertion) do
73-
assert_difference ['@object.num', '1 + 1'], 1, 'something went wrong' do
74-
@object.increment
75-
end
70+
def test_array_of_expressions_identify_failure_when_message_provided
71+
assert_raises(MiniTest::Assertion) do
72+
assert_difference ['@object.num', '1 + 1'], 1, 'something went wrong' do
73+
@object.increment
7674
end
7775
end
78-
else
79-
def default_test; end
8076
end
8177
end
8278

0 commit comments

Comments
 (0)