assert 2.18.4 → 2.19.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -2
- data/assert.gemspec +11 -5
- data/bin/assert +1 -0
- data/lib/assert.rb +20 -6
- data/lib/assert/actual_value.rb +26 -8
- data/lib/assert/assert_runner.rb +38 -17
- data/lib/assert/assertions.rb +145 -41
- data/lib/assert/cli.rb +19 -66
- data/lib/assert/clirb.rb +55 -0
- data/lib/assert/config.rb +22 -8
- data/lib/assert/config_helpers.rb +57 -22
- data/lib/assert/context.rb +28 -47
- data/lib/assert/context/let_dsl.rb +8 -2
- data/lib/assert/context/method_missing.rb +3 -0
- data/lib/assert/context/setup_dsl.rb +24 -16
- data/lib/assert/context/subject_dsl.rb +9 -7
- data/lib/assert/context/suite_dsl.rb +5 -1
- data/lib/assert/context/test_dsl.rb +58 -19
- data/lib/assert/context_info.rb +2 -0
- data/lib/assert/default_runner.rb +2 -0
- data/lib/assert/default_suite.rb +27 -15
- data/lib/assert/default_view.rb +49 -30
- data/lib/assert/factory.rb +2 -0
- data/lib/assert/file_line.rb +8 -6
- data/lib/assert/macro.rb +3 -1
- data/lib/assert/macros/methods.rb +73 -45
- data/lib/assert/result.rb +117 -61
- data/lib/assert/runner.rb +70 -51
- data/lib/assert/stub.rb +44 -3
- data/lib/assert/suite.rb +76 -38
- data/lib/assert/test.rb +43 -44
- data/lib/assert/utils.rb +22 -11
- data/lib/assert/version.rb +3 -1
- data/lib/assert/view.rb +46 -18
- data/lib/assert/view_helpers.rb +102 -92
- data/test/helper.rb +8 -4
- data/test/support/factory.rb +40 -21
- data/test/support/inherited_stuff.rb +2 -0
- data/test/system/stub_tests.rb +182 -144
- data/test/system/test_tests.rb +88 -60
- data/test/unit/actual_value_tests.rb +103 -46
- data/test/unit/assert_tests.rb +48 -40
- data/test/unit/assertions/assert_block_tests.rb +12 -10
- data/test/unit/assertions/assert_changes_tests.rb +103 -0
- data/test/unit/assertions/assert_empty_tests.rb +16 -12
- data/test/unit/assertions/assert_equal_tests.rb +46 -24
- data/test/unit/assertions/assert_file_exists_tests.rb +17 -13
- data/test/unit/assertions/assert_includes_tests.rb +12 -10
- data/test/unit/assertions/assert_instance_of_tests.rb +16 -14
- data/test/unit/assertions/assert_is_a_tests.rb +128 -0
- data/test/unit/assertions/assert_match_tests.rb +12 -10
- data/test/unit/assertions/assert_nil_tests.rb +18 -12
- data/test/unit/assertions/assert_raises_tests.rb +34 -23
- data/test/unit/assertions/assert_respond_to_tests.rb +12 -10
- data/test/unit/assertions/assert_same_tests.rb +26 -24
- data/test/unit/assertions/assert_true_false_tests.rb +34 -24
- data/test/unit/assertions_tests.rb +25 -17
- data/test/unit/config_helpers_tests.rb +15 -8
- data/test/unit/config_tests.rb +36 -9
- data/test/unit/context/let_dsl_tests.rb +2 -0
- data/test/unit/context/setup_dsl_tests.rb +26 -14
- data/test/unit/context/subject_dsl_tests.rb +5 -3
- data/test/unit/context/suite_dsl_tests.rb +6 -4
- data/test/unit/context/test_dsl_tests.rb +43 -19
- data/test/unit/context_info_tests.rb +6 -4
- data/test/unit/context_tests.rb +112 -54
- data/test/unit/default_runner_tests.rb +2 -0
- data/test/unit/default_suite_tests.rb +12 -6
- data/test/unit/factory_tests.rb +4 -2
- data/test/unit/file_line_tests.rb +9 -7
- data/test/unit/macro_tests.rb +13 -11
- data/test/unit/result_tests.rb +49 -41
- data/test/unit/runner_tests.rb +33 -18
- data/test/unit/suite_tests.rb +42 -24
- data/test/unit/test_tests.rb +66 -73
- data/test/unit/utils_tests.rb +52 -37
- data/test/unit/view_helpers_tests.rb +23 -14
- data/test/unit/view_tests.rb +7 -5
- metadata +40 -9
- data/test/unit/assertions/assert_kind_of_tests.rb +0 -66
data/test/system/test_tests.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "assert"
|
2
4
|
|
3
5
|
class Assert::Test
|
4
|
-
|
5
6
|
class SystemTests < Assert::Context
|
6
7
|
include Assert::Test::TestHelpers
|
7
8
|
|
@@ -14,7 +15,7 @@ class Assert::Test
|
|
14
15
|
|
15
16
|
class NoResultsTests < SystemTests
|
16
17
|
desc "when producing no results"
|
17
|
-
subject
|
18
|
+
subject{ Factory.test }
|
18
19
|
|
19
20
|
should "generate 0 results" do
|
20
21
|
assert_that(test_run_result_count).equals(0)
|
@@ -23,7 +24,13 @@ class Assert::Test
|
|
23
24
|
|
24
25
|
class PassTests < SystemTests
|
25
26
|
desc "when passing a single assertion"
|
26
|
-
subject
|
27
|
+
subject do
|
28
|
+
Factory.test do
|
29
|
+
assert(
|
30
|
+
1 == 1, # rubocop:disable Lint/BinaryOperatorWithIdenticalOperands
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
27
34
|
|
28
35
|
should "generate 1 result" do
|
29
36
|
assert_that(test_run_result_count).equals(1)
|
@@ -36,7 +43,7 @@ class Assert::Test
|
|
36
43
|
|
37
44
|
class FailTests < SystemTests
|
38
45
|
desc "when failing a single assertion"
|
39
|
-
subject
|
46
|
+
subject{ Factory.test{ assert(1 == 0) } }
|
40
47
|
|
41
48
|
should "generate 1 result" do
|
42
49
|
assert_that(test_run_result_count).equals(1)
|
@@ -49,7 +56,7 @@ class Assert::Test
|
|
49
56
|
|
50
57
|
class SkipTests < SystemTests
|
51
58
|
desc "when skipping once"
|
52
|
-
subject
|
59
|
+
subject{ Factory.test{ skip } }
|
53
60
|
|
54
61
|
should "generate 1 result" do
|
55
62
|
assert_that(test_run_result_count).equals(1)
|
@@ -62,7 +69,7 @@ class Assert::Test
|
|
62
69
|
|
63
70
|
class ErrorTests < SystemTests
|
64
71
|
desc "when erroring once"
|
65
|
-
subject
|
72
|
+
subject{ Factory.test{ raise("WHAT") } }
|
66
73
|
|
67
74
|
should "generate 1 result" do
|
68
75
|
assert_that(test_run_result_count).equals(1)
|
@@ -75,12 +82,14 @@ class Assert::Test
|
|
75
82
|
|
76
83
|
class MixedTests < SystemTests
|
77
84
|
desc "when passing 1 assertion and failing 1 assertion"
|
78
|
-
subject
|
85
|
+
subject do
|
79
86
|
Factory.test do
|
80
|
-
assert(
|
87
|
+
assert(
|
88
|
+
1 == 1, # rubocop:disable Lint/BinaryOperatorWithIdenticalOperands
|
89
|
+
)
|
81
90
|
assert(1 == 0)
|
82
91
|
end
|
83
|
-
|
92
|
+
end
|
84
93
|
|
85
94
|
should "generate 2 total results" do
|
86
95
|
assert_that(test_run_result_count).equals(2)
|
@@ -96,14 +105,17 @@ class Assert::Test
|
|
96
105
|
end
|
97
106
|
|
98
107
|
class MixedSkipTests < SystemTests
|
99
|
-
desc "when passing 1 assertion and failing 1 assertion with a skip call
|
100
|
-
|
108
|
+
desc "when passing 1 assertion and failing 1 assertion with a skip call "\
|
109
|
+
"in between"
|
110
|
+
subject do
|
101
111
|
Factory.test do
|
102
|
-
assert(
|
112
|
+
assert(
|
113
|
+
1 == 1, # rubocop:disable Lint/BinaryOperatorWithIdenticalOperands
|
114
|
+
)
|
103
115
|
skip
|
104
116
|
assert(1 == 0)
|
105
117
|
end
|
106
|
-
|
118
|
+
end
|
107
119
|
|
108
120
|
should "generate 2 total results" do
|
109
121
|
assert_that(test_run_result_count).equals(2)
|
@@ -127,14 +139,17 @@ class Assert::Test
|
|
127
139
|
end
|
128
140
|
|
129
141
|
class MixedErrorTests < SystemTests
|
130
|
-
desc "when passing 1 assertion and failing 1 assertion with an exception
|
131
|
-
|
142
|
+
desc "when passing 1 assertion and failing 1 assertion with an exception "\
|
143
|
+
"raised in between"
|
144
|
+
subject do
|
132
145
|
Factory.test do
|
133
|
-
assert(
|
134
|
-
|
135
|
-
|
146
|
+
assert(
|
147
|
+
1 == 1, # rubocop:disable Lint/BinaryOperatorWithIdenticalOperands
|
148
|
+
)
|
149
|
+
raise "something errored"
|
150
|
+
assert(1 == 0) # rubocop:disable Lint/UnreachableCode
|
136
151
|
end
|
137
|
-
|
152
|
+
end
|
138
153
|
|
139
154
|
should "generate 2 total results" do
|
140
155
|
assert_that(test_run_result_count).equals(2)
|
@@ -158,14 +173,17 @@ class Assert::Test
|
|
158
173
|
end
|
159
174
|
|
160
175
|
class MixedPassTests < SystemTests
|
161
|
-
desc "when passing 1 assertion and failing 1 assertion with a pass call
|
162
|
-
|
176
|
+
desc "when passing 1 assertion and failing 1 assertion with a pass call "\
|
177
|
+
"in between"
|
178
|
+
subject do
|
163
179
|
Factory.test do
|
164
|
-
assert(
|
180
|
+
assert(
|
181
|
+
1 == 1, # rubocop:disable Lint/BinaryOperatorWithIdenticalOperands
|
182
|
+
)
|
165
183
|
pass
|
166
184
|
assert(1 == 0)
|
167
185
|
end
|
168
|
-
|
186
|
+
end
|
169
187
|
|
170
188
|
should "generate 3 total results" do
|
171
189
|
assert_that(test_run_result_count).equals(3)
|
@@ -185,14 +203,17 @@ class Assert::Test
|
|
185
203
|
end
|
186
204
|
|
187
205
|
class MixedFailTests < SystemTests
|
188
|
-
desc "when failing 1 assertion and passing 1 assertion with a fail call
|
189
|
-
|
206
|
+
desc "when failing 1 assertion and passing 1 assertion with a fail call "\
|
207
|
+
"in between"
|
208
|
+
subject do
|
190
209
|
Factory.test do
|
191
210
|
assert(1 == 0)
|
192
|
-
fail
|
193
|
-
assert(
|
211
|
+
fail # rubocop:disable Style/SignalException
|
212
|
+
assert( # rubocop:disable Lint/UnreachableCode
|
213
|
+
1 == 1, # rubocop:disable Lint/BinaryOperatorWithIdenticalOperands
|
214
|
+
)
|
194
215
|
end
|
195
|
-
|
216
|
+
end
|
196
217
|
|
197
218
|
should "generate 3 total results" do
|
198
219
|
assert_that(test_run_result_count).equals(3)
|
@@ -212,14 +233,17 @@ class Assert::Test
|
|
212
233
|
end
|
213
234
|
|
214
235
|
class MixedFlunkTests < SystemTests
|
215
|
-
desc "has failing 1 assertion and passing 1 assertion with a flunk call
|
216
|
-
|
236
|
+
desc "has failing 1 assertion and passing 1 assertion with a flunk call "\
|
237
|
+
"in between"
|
238
|
+
subject do
|
217
239
|
Factory.test do
|
218
240
|
assert(1 == 0)
|
219
241
|
flunk
|
220
|
-
assert(
|
242
|
+
assert(
|
243
|
+
1 == 1, # rubocop:disable Lint/BinaryOperatorWithIdenticalOperands
|
244
|
+
)
|
221
245
|
end
|
222
|
-
|
246
|
+
end
|
223
247
|
|
224
248
|
should "generate 3 total results" do
|
225
249
|
assert_that(test_run_result_count).equals(3)
|
@@ -240,18 +264,20 @@ class Assert::Test
|
|
240
264
|
|
241
265
|
class WithSetupsTests < SystemTests
|
242
266
|
desc "that has setup logic"
|
243
|
-
subject
|
244
|
-
Factory.test("t", Factory.context_info(context_class1))
|
245
|
-
|
267
|
+
subject do
|
268
|
+
Factory.test("t", Factory.context_info(context_class1)){ pass "TEST" }
|
269
|
+
end
|
246
270
|
|
247
|
-
let(:context_class1)
|
271
|
+
let(:context_class1) do
|
248
272
|
Factory.context_class do
|
249
273
|
# assert style
|
250
|
-
setup
|
274
|
+
setup{ pass "assert style setup" }
|
251
275
|
# test/unit style
|
252
|
-
def setup
|
276
|
+
def setup
|
277
|
+
pass "test/unit style setup"
|
278
|
+
end
|
253
279
|
end
|
254
|
-
|
280
|
+
end
|
255
281
|
|
256
282
|
should "execute all setup logic when run" do
|
257
283
|
assert_that(test_run_result_count(:pass)).equals(3)
|
@@ -263,18 +289,20 @@ class Assert::Test
|
|
263
289
|
|
264
290
|
class WithTeardownsTests < SystemTests
|
265
291
|
desc "that has teardown logic"
|
266
|
-
subject
|
267
|
-
Factory.test("t", Factory.context_info(context_class1))
|
268
|
-
|
292
|
+
subject do
|
293
|
+
Factory.test("t", Factory.context_info(context_class1)){ pass "TEST" }
|
294
|
+
end
|
269
295
|
|
270
|
-
let(:context_class1)
|
296
|
+
let(:context_class1) do
|
271
297
|
Factory.context_class do
|
272
298
|
# assert style
|
273
|
-
teardown
|
299
|
+
teardown{ pass "assert style teardown" }
|
274
300
|
# test/unit style
|
275
|
-
def teardown
|
301
|
+
def teardown
|
302
|
+
pass "test/unit style teardown"
|
303
|
+
end
|
276
304
|
end
|
277
|
-
|
305
|
+
end
|
278
306
|
|
279
307
|
should "execute all teardown logic when run" do
|
280
308
|
assert_that(test_run_result_count(:pass)).equals(3)
|
@@ -286,39 +314,39 @@ class Assert::Test
|
|
286
314
|
|
287
315
|
class WithAroundsTests < SystemTests
|
288
316
|
desc "that has around logic (in addition to setups/teardowns)"
|
289
|
-
subject
|
290
|
-
Factory.test("t", Factory.context_info(context_class1))
|
291
|
-
|
317
|
+
subject do
|
318
|
+
Factory.test("t", Factory.context_info(context_class1)){ pass "TEST" }
|
319
|
+
end
|
292
320
|
|
293
|
-
let(:parent_context_class1)
|
321
|
+
let(:parent_context_class1) do
|
294
322
|
Factory.modes_off_context_class do
|
295
323
|
around do |block|
|
296
324
|
pass "parent around start"
|
297
325
|
block.call
|
298
326
|
pass "parent around end"
|
299
327
|
end
|
300
|
-
setup
|
301
|
-
teardown
|
328
|
+
setup{ pass "parent setup" }
|
329
|
+
teardown{ pass "parent teardown" }
|
302
330
|
end
|
303
|
-
|
304
|
-
let(:context_class1)
|
331
|
+
end
|
332
|
+
let(:context_class1) do
|
305
333
|
Factory.modes_off_context_class(parent_context_class1) do
|
306
|
-
setup
|
334
|
+
setup{ pass "child setup1" }
|
307
335
|
around do |block|
|
308
336
|
pass "child around1 start"
|
309
337
|
block.call
|
310
338
|
pass "child around1 end"
|
311
339
|
end
|
312
|
-
teardown
|
313
|
-
setup
|
340
|
+
teardown{ pass "child teardown1" }
|
341
|
+
setup{ pass "child setup2" }
|
314
342
|
around do |block|
|
315
343
|
pass "child around2 start"
|
316
344
|
block.call
|
317
345
|
pass "child around2 end"
|
318
346
|
end
|
319
|
-
teardown
|
347
|
+
teardown{ pass "child teardown2" }
|
320
348
|
end
|
321
|
-
|
349
|
+
end
|
322
350
|
|
323
351
|
should "run the arounds outside of the setups/teardowns/test" do
|
324
352
|
assert_that(test_run_result_count(:pass)).equals(13)
|
@@ -327,7 +355,7 @@ class Assert::Test
|
|
327
355
|
"parent around start", "child around1 start", "child around2 start",
|
328
356
|
"parent setup", "child setup1", "child setup2", "TEST",
|
329
357
|
"child teardown1", "child teardown2", "parent teardown",
|
330
|
-
"child around2 end", "child around1 end", "parent around end"
|
358
|
+
"child around2 end", "child around1 end", "parent around end",
|
331
359
|
]
|
332
360
|
assert_that(test_run_result_messages).equals(exp)
|
333
361
|
end
|
@@ -1,29 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "assert"
|
2
4
|
require "assert/actual_value"
|
3
5
|
|
4
6
|
class Assert::ActualValue
|
5
7
|
class UnitTests < Assert::Context
|
6
8
|
desc "Assert::ActualValue"
|
7
|
-
subject
|
9
|
+
subject{ unit_class }
|
8
10
|
|
9
|
-
let(:unit_class)
|
11
|
+
let(:unit_class){ Assert::ActualValue }
|
10
12
|
end
|
11
13
|
|
12
14
|
class InitTests < UnitTests
|
13
15
|
desc "when init"
|
14
|
-
subject
|
16
|
+
subject{ unit_class.new(actual_value1, context: context1) }
|
15
17
|
|
16
|
-
let(:actual_value1)
|
17
|
-
let(:context1)
|
18
|
+
let(:actual_value1){ Factory.string }
|
19
|
+
let(:context1){ Factory.modes_off_context }
|
18
20
|
|
19
21
|
should have_imeths :returns_true, :does_not_return_true
|
20
22
|
should have_imeths :raises, :does_not_raise
|
23
|
+
should have_imeths :changes, :does_not_change
|
24
|
+
should have_imeths :is_a, :is_not_a
|
21
25
|
should have_imeths :is_a_kind_of, :is_not_a_kind_of
|
22
26
|
should have_imeths :is_kind_of, :is_not_kind_of
|
23
27
|
should have_imeths :is_an_instance_of, :is_not_an_instance_of
|
24
28
|
should have_imeths :is_instance_of, :is_not_instance_of
|
25
29
|
should have_imeths :responds_to, :does_not_respond_to
|
26
30
|
should have_imeths :is_the_same_as, :is_not_the_same_as
|
31
|
+
should have_imeths :is, :is_not
|
27
32
|
should have_imeths :equals, :does_not_equal
|
28
33
|
should have_imeths :is_equal_to, :is_not_equal_to
|
29
34
|
should have_imeths :matches, :does_not_match
|
@@ -38,14 +43,14 @@ class Assert::ActualValue
|
|
38
43
|
class MethodsTests < InitTests
|
39
44
|
desc "methods"
|
40
45
|
|
41
|
-
let(:args1)
|
42
|
-
let(:capture_last_call_block)
|
46
|
+
let(:args1){ Factory.integer(3).times.map{ Factory.string } }
|
47
|
+
let(:capture_last_call_block){ ->(call){ @last_call = call } }
|
43
48
|
|
44
49
|
should "call to their equivalent context methods" do
|
45
50
|
assert_calls(
|
46
51
|
:assert_block,
|
47
52
|
when_calling: :returns_true,
|
48
|
-
on_value: ->
|
53
|
+
on_value: ->{},
|
49
54
|
) do |value, call|
|
50
55
|
assert_equal args1, call.args
|
51
56
|
assert_equal value, call.block
|
@@ -54,7 +59,7 @@ class Assert::ActualValue
|
|
54
59
|
assert_calls(
|
55
60
|
:assert_not_block,
|
56
61
|
when_calling: :does_not_return_true,
|
57
|
-
on_value: ->
|
62
|
+
on_value: ->{},
|
58
63
|
) do |value, call|
|
59
64
|
assert_equal args1, call.args
|
60
65
|
assert_equal value, call.block
|
@@ -63,7 +68,7 @@ class Assert::ActualValue
|
|
63
68
|
assert_calls(
|
64
69
|
:assert_raises,
|
65
70
|
when_calling: :raises,
|
66
|
-
on_value: ->
|
71
|
+
on_value: ->{},
|
67
72
|
) do |value, call|
|
68
73
|
assert_equal args1, call.args
|
69
74
|
assert_equal value, call.block
|
@@ -72,40 +77,74 @@ class Assert::ActualValue
|
|
72
77
|
assert_calls(
|
73
78
|
:assert_nothing_raised,
|
74
79
|
when_calling: :does_not_raise,
|
75
|
-
on_value: ->
|
80
|
+
on_value: ->{},
|
81
|
+
) do |value, call|
|
82
|
+
assert_equal args1, call.args
|
83
|
+
assert_equal value, call.block
|
84
|
+
end
|
85
|
+
|
86
|
+
assert_calls(
|
87
|
+
:assert_changes,
|
88
|
+
when_calling: :changes,
|
89
|
+
on_value: ->{},
|
90
|
+
) do |value, call|
|
91
|
+
assert_equal args1, call.args
|
92
|
+
assert_equal value, call.block
|
93
|
+
end
|
94
|
+
|
95
|
+
assert_calls(
|
96
|
+
:assert_not_changes,
|
97
|
+
when_calling: :does_not_change,
|
98
|
+
on_value: ->{},
|
76
99
|
) do |value, call|
|
77
100
|
assert_equal args1, call.args
|
78
101
|
assert_equal value, call.block
|
79
102
|
end
|
80
103
|
|
81
104
|
assert_calls(
|
82
|
-
:
|
105
|
+
:assert_is_a,
|
106
|
+
when_calling: [:is_a, String],
|
107
|
+
on_value: actual_value1,
|
108
|
+
) do |value, call|
|
109
|
+
assert_equal [String, value, *args1], call.args
|
110
|
+
end
|
111
|
+
|
112
|
+
assert_calls(
|
113
|
+
:assert_is_a,
|
83
114
|
when_calling: [:is_a_kind_of, String],
|
84
|
-
on_value: actual_value1
|
115
|
+
on_value: actual_value1,
|
85
116
|
) do |value, call|
|
86
117
|
assert_equal [String, value, *args1], call.args
|
87
118
|
end
|
88
119
|
|
89
120
|
assert_calls(
|
90
|
-
:
|
121
|
+
:assert_is_a,
|
91
122
|
when_calling: [:is_kind_of, String],
|
92
|
-
on_value: actual_value1
|
123
|
+
on_value: actual_value1,
|
93
124
|
) do |value, call|
|
94
125
|
assert_equal [String, value, *args1], call.args
|
95
126
|
end
|
96
127
|
|
97
128
|
assert_calls(
|
98
|
-
:
|
129
|
+
:assert_is_not_a,
|
130
|
+
when_calling: [:is_not_a, String],
|
131
|
+
on_value: actual_value1,
|
132
|
+
) do |value, call|
|
133
|
+
assert_equal [String, value, *args1], call.args
|
134
|
+
end
|
135
|
+
|
136
|
+
assert_calls(
|
137
|
+
:assert_is_not_a,
|
99
138
|
when_calling: [:is_not_a_kind_of, String],
|
100
|
-
on_value: actual_value1
|
139
|
+
on_value: actual_value1,
|
101
140
|
) do |value, call|
|
102
141
|
assert_equal [String, value, *args1], call.args
|
103
142
|
end
|
104
143
|
|
105
144
|
assert_calls(
|
106
|
-
:
|
145
|
+
:assert_is_not_a,
|
107
146
|
when_calling: [:is_not_kind_of, String],
|
108
|
-
on_value: actual_value1
|
147
|
+
on_value: actual_value1,
|
109
148
|
) do |value, call|
|
110
149
|
assert_equal [String, value, *args1], call.args
|
111
150
|
end
|
@@ -113,7 +152,7 @@ class Assert::ActualValue
|
|
113
152
|
assert_calls(
|
114
153
|
:assert_instance_of,
|
115
154
|
when_calling: [:is_an_instance_of, String],
|
116
|
-
on_value: actual_value1
|
155
|
+
on_value: actual_value1,
|
117
156
|
) do |value, call|
|
118
157
|
assert_equal [String, value, *args1], call.args
|
119
158
|
end
|
@@ -121,7 +160,7 @@ class Assert::ActualValue
|
|
121
160
|
assert_calls(
|
122
161
|
:assert_instance_of,
|
123
162
|
when_calling: [:is_instance_of, String],
|
124
|
-
on_value: actual_value1
|
163
|
+
on_value: actual_value1,
|
125
164
|
) do |value, call|
|
126
165
|
assert_equal [String, value, *args1], call.args
|
127
166
|
end
|
@@ -129,7 +168,7 @@ class Assert::ActualValue
|
|
129
168
|
assert_calls(
|
130
169
|
:assert_not_instance_of,
|
131
170
|
when_calling: [:is_not_an_instance_of, String],
|
132
|
-
on_value: actual_value1
|
171
|
+
on_value: actual_value1,
|
133
172
|
) do |value, call|
|
134
173
|
assert_equal [String, value, *args1], call.args
|
135
174
|
end
|
@@ -137,7 +176,7 @@ class Assert::ActualValue
|
|
137
176
|
assert_calls(
|
138
177
|
:assert_not_instance_of,
|
139
178
|
when_calling: [:is_not_instance_of, String],
|
140
|
-
on_value: actual_value1
|
179
|
+
on_value: actual_value1,
|
141
180
|
) do |value, call|
|
142
181
|
assert_equal [String, value, *args1], call.args
|
143
182
|
end
|
@@ -145,7 +184,7 @@ class Assert::ActualValue
|
|
145
184
|
assert_calls(
|
146
185
|
:assert_responds_to,
|
147
186
|
when_calling: [:responds_to, :method],
|
148
|
-
on_value: actual_value1
|
187
|
+
on_value: actual_value1,
|
149
188
|
) do |value, call|
|
150
189
|
assert_equal [:method, value, *args1], call.args
|
151
190
|
end
|
@@ -153,7 +192,7 @@ class Assert::ActualValue
|
|
153
192
|
assert_calls(
|
154
193
|
:assert_not_responds_to,
|
155
194
|
when_calling: [:does_not_respond_to, :method],
|
156
|
-
on_value: actual_value1
|
195
|
+
on_value: actual_value1,
|
157
196
|
) do |value, call|
|
158
197
|
assert_equal [:method, value, *args1], call.args
|
159
198
|
end
|
@@ -161,7 +200,15 @@ class Assert::ActualValue
|
|
161
200
|
assert_calls(
|
162
201
|
:assert_same,
|
163
202
|
when_calling: [:is_the_same_as, "something"],
|
164
|
-
on_value: actual_value1
|
203
|
+
on_value: actual_value1,
|
204
|
+
) do |value, call|
|
205
|
+
assert_equal ["something", value, *args1], call.args
|
206
|
+
end
|
207
|
+
|
208
|
+
assert_calls(
|
209
|
+
:assert_same,
|
210
|
+
when_calling: [:is, "something"],
|
211
|
+
on_value: actual_value1,
|
165
212
|
) do |value, call|
|
166
213
|
assert_equal ["something", value, *args1], call.args
|
167
214
|
end
|
@@ -169,7 +216,15 @@ class Assert::ActualValue
|
|
169
216
|
assert_calls(
|
170
217
|
:assert_not_same,
|
171
218
|
when_calling: [:is_not_the_same_as, "something"],
|
172
|
-
on_value: actual_value1
|
219
|
+
on_value: actual_value1,
|
220
|
+
) do |value, call|
|
221
|
+
assert_equal ["something", value, *args1], call.args
|
222
|
+
end
|
223
|
+
|
224
|
+
assert_calls(
|
225
|
+
:assert_not_same,
|
226
|
+
when_calling: [:is_not, "something"],
|
227
|
+
on_value: actual_value1,
|
173
228
|
) do |value, call|
|
174
229
|
assert_equal ["something", value, *args1], call.args
|
175
230
|
end
|
@@ -177,7 +232,7 @@ class Assert::ActualValue
|
|
177
232
|
assert_calls(
|
178
233
|
:assert_equal,
|
179
234
|
when_calling: [:equals, "something"],
|
180
|
-
on_value: actual_value1
|
235
|
+
on_value: actual_value1,
|
181
236
|
) do |value, call|
|
182
237
|
assert_equal ["something", value, *args1], call.args
|
183
238
|
end
|
@@ -185,7 +240,7 @@ class Assert::ActualValue
|
|
185
240
|
assert_calls(
|
186
241
|
:assert_equal,
|
187
242
|
when_calling: [:is_equal_to, "something"],
|
188
|
-
on_value: actual_value1
|
243
|
+
on_value: actual_value1,
|
189
244
|
) do |value, call|
|
190
245
|
assert_equal ["something", value, *args1], call.args
|
191
246
|
end
|
@@ -193,7 +248,7 @@ class Assert::ActualValue
|
|
193
248
|
assert_calls(
|
194
249
|
:assert_not_equal,
|
195
250
|
when_calling: [:does_not_equal, "something"],
|
196
|
-
on_value: actual_value1
|
251
|
+
on_value: actual_value1,
|
197
252
|
) do |value, call|
|
198
253
|
assert_equal ["something", value, *args1], call.args
|
199
254
|
end
|
@@ -201,7 +256,7 @@ class Assert::ActualValue
|
|
201
256
|
assert_calls(
|
202
257
|
:assert_not_equal,
|
203
258
|
when_calling: [:is_not_equal_to, "something"],
|
204
|
-
on_value: actual_value1
|
259
|
+
on_value: actual_value1,
|
205
260
|
) do |value, call|
|
206
261
|
assert_equal ["something", value, *args1], call.args
|
207
262
|
end
|
@@ -209,7 +264,7 @@ class Assert::ActualValue
|
|
209
264
|
assert_calls(
|
210
265
|
:assert_match,
|
211
266
|
when_calling: [:matches, "something"],
|
212
|
-
on_value: actual_value1
|
267
|
+
on_value: actual_value1,
|
213
268
|
) do |value, call|
|
214
269
|
assert_equal ["something", value, *args1], call.args
|
215
270
|
end
|
@@ -217,7 +272,7 @@ class Assert::ActualValue
|
|
217
272
|
assert_calls(
|
218
273
|
:assert_not_match,
|
219
274
|
when_calling: [:does_not_match, "something"],
|
220
|
-
on_value: actual_value1
|
275
|
+
on_value: actual_value1,
|
221
276
|
) do |value, call|
|
222
277
|
assert_equal ["something", value, *args1], call.args
|
223
278
|
end
|
@@ -225,7 +280,7 @@ class Assert::ActualValue
|
|
225
280
|
assert_calls(
|
226
281
|
:assert_empty,
|
227
282
|
when_calling: :is_empty,
|
228
|
-
on_value: actual_value1
|
283
|
+
on_value: actual_value1,
|
229
284
|
) do |value, call|
|
230
285
|
assert_equal [value, *args1], call.args
|
231
286
|
end
|
@@ -233,7 +288,7 @@ class Assert::ActualValue
|
|
233
288
|
assert_calls(
|
234
289
|
:assert_not_empty,
|
235
290
|
when_calling: :is_not_empty,
|
236
|
-
on_value: actual_value1
|
291
|
+
on_value: actual_value1,
|
237
292
|
) do |value, call|
|
238
293
|
assert_equal [value, *args1], call.args
|
239
294
|
end
|
@@ -241,7 +296,7 @@ class Assert::ActualValue
|
|
241
296
|
assert_calls(
|
242
297
|
:assert_includes,
|
243
298
|
when_calling: [:includes, "something"],
|
244
|
-
on_value: actual_value1
|
299
|
+
on_value: actual_value1,
|
245
300
|
) do |value, call|
|
246
301
|
assert_equal ["something", value, *args1], call.args
|
247
302
|
end
|
@@ -249,7 +304,7 @@ class Assert::ActualValue
|
|
249
304
|
assert_calls(
|
250
305
|
:assert_not_includes,
|
251
306
|
when_calling: [:does_not_include, "something"],
|
252
|
-
on_value: actual_value1
|
307
|
+
on_value: actual_value1,
|
253
308
|
) do |value, call|
|
254
309
|
assert_equal ["something", value, *args1], call.args
|
255
310
|
end
|
@@ -257,7 +312,7 @@ class Assert::ActualValue
|
|
257
312
|
assert_calls(
|
258
313
|
:assert_nil,
|
259
314
|
when_calling: :is_nil,
|
260
|
-
on_value: actual_value1
|
315
|
+
on_value: actual_value1,
|
261
316
|
) do |value, call|
|
262
317
|
assert_equal [value, *args1], call.args
|
263
318
|
end
|
@@ -265,7 +320,7 @@ class Assert::ActualValue
|
|
265
320
|
assert_calls(
|
266
321
|
:assert_not_nil,
|
267
322
|
when_calling: :is_not_nil,
|
268
|
-
on_value: actual_value1
|
323
|
+
on_value: actual_value1,
|
269
324
|
) do |value, call|
|
270
325
|
assert_equal [value, *args1], call.args
|
271
326
|
end
|
@@ -273,7 +328,7 @@ class Assert::ActualValue
|
|
273
328
|
assert_calls(
|
274
329
|
:assert_true,
|
275
330
|
when_calling: :is_true,
|
276
|
-
on_value: actual_value1
|
331
|
+
on_value: actual_value1,
|
277
332
|
) do |value, call|
|
278
333
|
assert_equal [value, *args1], call.args
|
279
334
|
end
|
@@ -281,7 +336,7 @@ class Assert::ActualValue
|
|
281
336
|
assert_calls(
|
282
337
|
:assert_not_true,
|
283
338
|
when_calling: :is_not_true,
|
284
|
-
on_value: actual_value1
|
339
|
+
on_value: actual_value1,
|
285
340
|
) do |value, call|
|
286
341
|
assert_equal [value, *args1], call.args
|
287
342
|
end
|
@@ -289,7 +344,7 @@ class Assert::ActualValue
|
|
289
344
|
assert_calls(
|
290
345
|
:assert_false,
|
291
346
|
when_calling: :is_false,
|
292
|
-
on_value: actual_value1
|
347
|
+
on_value: actual_value1,
|
293
348
|
) do |value, call|
|
294
349
|
assert_equal [value, *args1], call.args
|
295
350
|
end
|
@@ -297,7 +352,7 @@ class Assert::ActualValue
|
|
297
352
|
assert_calls(
|
298
353
|
:assert_not_false,
|
299
354
|
when_calling: :is_not_false,
|
300
|
-
on_value: actual_value1
|
355
|
+
on_value: actual_value1,
|
301
356
|
) do |value, call|
|
302
357
|
assert_equal [value, *args1], call.args
|
303
358
|
end
|
@@ -305,7 +360,7 @@ class Assert::ActualValue
|
|
305
360
|
assert_calls(
|
306
361
|
:assert_file_exists,
|
307
362
|
when_calling: :is_a_file,
|
308
|
-
on_value: actual_value1
|
363
|
+
on_value: actual_value1,
|
309
364
|
) do |value, call|
|
310
365
|
assert_equal [value, *args1], call.args
|
311
366
|
end
|
@@ -313,7 +368,7 @@ class Assert::ActualValue
|
|
313
368
|
assert_calls(
|
314
369
|
:assert_not_file_exists,
|
315
370
|
when_calling: :is_not_a_file,
|
316
|
-
on_value: actual_value1
|
371
|
+
on_value: actual_value1,
|
317
372
|
) do |value, call|
|
318
373
|
assert_equal [value, *args1], call.args
|
319
374
|
end
|
@@ -325,7 +380,9 @@ class Assert::ActualValue
|
|
325
380
|
@last_call = nil
|
326
381
|
Assert.stub_on_call(context1, context_method, &capture_last_call_block)
|
327
382
|
|
328
|
-
unit_class
|
383
|
+
unit_class
|
384
|
+
.new(on_value, context: context1)
|
385
|
+
.public_send(*when_calling, *args1)
|
329
386
|
yield(on_value, @last_call)
|
330
387
|
|
331
388
|
Assert.unstub(context1, context_method)
|