assert 2.19.0 → 2.19.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +4 -2
- data/assert.gemspec +11 -6
- data/bin/assert +1 -0
- data/lib/assert.rb +20 -6
- data/lib/assert/actual_value.rb +11 -6
- data/lib/assert/assert_runner.rb +38 -17
- data/lib/assert/assertions.rb +85 -50
- data/lib/assert/cli.rb +32 -70
- 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 +16 -18
- 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 +114 -62
- data/lib/assert/runner.rb +70 -51
- data/lib/assert/stub.rb +44 -3
- data/lib/assert/suite.rb +69 -28
- data/lib/assert/test.rb +43 -36
- 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 +71 -50
- data/test/unit/assert_tests.rb +42 -23
- data/test/unit/assertions/assert_block_tests.rb +12 -10
- data/test/unit/assertions/assert_changes_tests.rb +27 -21
- data/test/unit/assertions/assert_empty_tests.rb +16 -12
- data/test/unit/assertions/assert_equal_tests.rb +28 -26
- 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 +29 -20
- 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 +16 -9
- data/test/unit/config_helpers_tests.rb +17 -10
- 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 +39 -17
- 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 +39 -15
- data/test/unit/test_tests.rb +65 -50
- 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 +26 -11
- 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,24 +1,27 @@
|
|
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
|
21
23
|
should have_imeths :changes, :does_not_change
|
24
|
+
should have_imeths :is_a, :is_not_a
|
22
25
|
should have_imeths :is_a_kind_of, :is_not_a_kind_of
|
23
26
|
should have_imeths :is_kind_of, :is_not_kind_of
|
24
27
|
should have_imeths :is_an_instance_of, :is_not_an_instance_of
|
@@ -40,14 +43,14 @@ class Assert::ActualValue
|
|
40
43
|
class MethodsTests < InitTests
|
41
44
|
desc "methods"
|
42
45
|
|
43
|
-
let(:args1)
|
44
|
-
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 } }
|
45
48
|
|
46
49
|
should "call to their equivalent context methods" do
|
47
50
|
assert_calls(
|
48
51
|
:assert_block,
|
49
52
|
when_calling: :returns_true,
|
50
|
-
on_value: ->
|
53
|
+
on_value: ->{},
|
51
54
|
) do |value, call|
|
52
55
|
assert_equal args1, call.args
|
53
56
|
assert_equal value, call.block
|
@@ -56,7 +59,7 @@ class Assert::ActualValue
|
|
56
59
|
assert_calls(
|
57
60
|
:assert_not_block,
|
58
61
|
when_calling: :does_not_return_true,
|
59
|
-
on_value: ->
|
62
|
+
on_value: ->{},
|
60
63
|
) do |value, call|
|
61
64
|
assert_equal args1, call.args
|
62
65
|
assert_equal value, call.block
|
@@ -65,7 +68,7 @@ class Assert::ActualValue
|
|
65
68
|
assert_calls(
|
66
69
|
:assert_raises,
|
67
70
|
when_calling: :raises,
|
68
|
-
on_value: ->
|
71
|
+
on_value: ->{},
|
69
72
|
) do |value, call|
|
70
73
|
assert_equal args1, call.args
|
71
74
|
assert_equal value, call.block
|
@@ -74,7 +77,7 @@ class Assert::ActualValue
|
|
74
77
|
assert_calls(
|
75
78
|
:assert_nothing_raised,
|
76
79
|
when_calling: :does_not_raise,
|
77
|
-
on_value: ->
|
80
|
+
on_value: ->{},
|
78
81
|
) do |value, call|
|
79
82
|
assert_equal args1, call.args
|
80
83
|
assert_equal value, call.block
|
@@ -83,7 +86,7 @@ class Assert::ActualValue
|
|
83
86
|
assert_calls(
|
84
87
|
:assert_changes,
|
85
88
|
when_calling: :changes,
|
86
|
-
on_value: ->
|
89
|
+
on_value: ->{},
|
87
90
|
) do |value, call|
|
88
91
|
assert_equal args1, call.args
|
89
92
|
assert_equal value, call.block
|
@@ -92,40 +95,56 @@ class Assert::ActualValue
|
|
92
95
|
assert_calls(
|
93
96
|
:assert_not_changes,
|
94
97
|
when_calling: :does_not_change,
|
95
|
-
on_value: ->
|
98
|
+
on_value: ->{},
|
96
99
|
) do |value, call|
|
97
100
|
assert_equal args1, call.args
|
98
101
|
assert_equal value, call.block
|
99
102
|
end
|
100
103
|
|
101
104
|
assert_calls(
|
102
|
-
:
|
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,
|
103
114
|
when_calling: [:is_a_kind_of, String],
|
104
|
-
on_value: actual_value1
|
115
|
+
on_value: actual_value1,
|
105
116
|
) do |value, call|
|
106
117
|
assert_equal [String, value, *args1], call.args
|
107
118
|
end
|
108
119
|
|
109
120
|
assert_calls(
|
110
|
-
:
|
121
|
+
:assert_is_a,
|
111
122
|
when_calling: [:is_kind_of, String],
|
112
|
-
on_value: actual_value1
|
123
|
+
on_value: actual_value1,
|
124
|
+
) do |value, call|
|
125
|
+
assert_equal [String, value, *args1], call.args
|
126
|
+
end
|
127
|
+
|
128
|
+
assert_calls(
|
129
|
+
:assert_is_not_a,
|
130
|
+
when_calling: [:is_not_a, String],
|
131
|
+
on_value: actual_value1,
|
113
132
|
) do |value, call|
|
114
133
|
assert_equal [String, value, *args1], call.args
|
115
134
|
end
|
116
135
|
|
117
136
|
assert_calls(
|
118
|
-
:
|
137
|
+
:assert_is_not_a,
|
119
138
|
when_calling: [:is_not_a_kind_of, String],
|
120
|
-
on_value: actual_value1
|
139
|
+
on_value: actual_value1,
|
121
140
|
) do |value, call|
|
122
141
|
assert_equal [String, value, *args1], call.args
|
123
142
|
end
|
124
143
|
|
125
144
|
assert_calls(
|
126
|
-
:
|
145
|
+
:assert_is_not_a,
|
127
146
|
when_calling: [:is_not_kind_of, String],
|
128
|
-
on_value: actual_value1
|
147
|
+
on_value: actual_value1,
|
129
148
|
) do |value, call|
|
130
149
|
assert_equal [String, value, *args1], call.args
|
131
150
|
end
|
@@ -133,7 +152,7 @@ class Assert::ActualValue
|
|
133
152
|
assert_calls(
|
134
153
|
:assert_instance_of,
|
135
154
|
when_calling: [:is_an_instance_of, String],
|
136
|
-
on_value: actual_value1
|
155
|
+
on_value: actual_value1,
|
137
156
|
) do |value, call|
|
138
157
|
assert_equal [String, value, *args1], call.args
|
139
158
|
end
|
@@ -141,7 +160,7 @@ class Assert::ActualValue
|
|
141
160
|
assert_calls(
|
142
161
|
:assert_instance_of,
|
143
162
|
when_calling: [:is_instance_of, String],
|
144
|
-
on_value: actual_value1
|
163
|
+
on_value: actual_value1,
|
145
164
|
) do |value, call|
|
146
165
|
assert_equal [String, value, *args1], call.args
|
147
166
|
end
|
@@ -149,7 +168,7 @@ class Assert::ActualValue
|
|
149
168
|
assert_calls(
|
150
169
|
:assert_not_instance_of,
|
151
170
|
when_calling: [:is_not_an_instance_of, String],
|
152
|
-
on_value: actual_value1
|
171
|
+
on_value: actual_value1,
|
153
172
|
) do |value, call|
|
154
173
|
assert_equal [String, value, *args1], call.args
|
155
174
|
end
|
@@ -157,7 +176,7 @@ class Assert::ActualValue
|
|
157
176
|
assert_calls(
|
158
177
|
:assert_not_instance_of,
|
159
178
|
when_calling: [:is_not_instance_of, String],
|
160
|
-
on_value: actual_value1
|
179
|
+
on_value: actual_value1,
|
161
180
|
) do |value, call|
|
162
181
|
assert_equal [String, value, *args1], call.args
|
163
182
|
end
|
@@ -165,7 +184,7 @@ class Assert::ActualValue
|
|
165
184
|
assert_calls(
|
166
185
|
:assert_responds_to,
|
167
186
|
when_calling: [:responds_to, :method],
|
168
|
-
on_value: actual_value1
|
187
|
+
on_value: actual_value1,
|
169
188
|
) do |value, call|
|
170
189
|
assert_equal [:method, value, *args1], call.args
|
171
190
|
end
|
@@ -173,7 +192,7 @@ class Assert::ActualValue
|
|
173
192
|
assert_calls(
|
174
193
|
:assert_not_responds_to,
|
175
194
|
when_calling: [:does_not_respond_to, :method],
|
176
|
-
on_value: actual_value1
|
195
|
+
on_value: actual_value1,
|
177
196
|
) do |value, call|
|
178
197
|
assert_equal [:method, value, *args1], call.args
|
179
198
|
end
|
@@ -181,7 +200,7 @@ class Assert::ActualValue
|
|
181
200
|
assert_calls(
|
182
201
|
:assert_same,
|
183
202
|
when_calling: [:is_the_same_as, "something"],
|
184
|
-
on_value: actual_value1
|
203
|
+
on_value: actual_value1,
|
185
204
|
) do |value, call|
|
186
205
|
assert_equal ["something", value, *args1], call.args
|
187
206
|
end
|
@@ -189,7 +208,7 @@ class Assert::ActualValue
|
|
189
208
|
assert_calls(
|
190
209
|
:assert_same,
|
191
210
|
when_calling: [:is, "something"],
|
192
|
-
on_value: actual_value1
|
211
|
+
on_value: actual_value1,
|
193
212
|
) do |value, call|
|
194
213
|
assert_equal ["something", value, *args1], call.args
|
195
214
|
end
|
@@ -197,7 +216,7 @@ class Assert::ActualValue
|
|
197
216
|
assert_calls(
|
198
217
|
:assert_not_same,
|
199
218
|
when_calling: [:is_not_the_same_as, "something"],
|
200
|
-
on_value: actual_value1
|
219
|
+
on_value: actual_value1,
|
201
220
|
) do |value, call|
|
202
221
|
assert_equal ["something", value, *args1], call.args
|
203
222
|
end
|
@@ -205,7 +224,7 @@ class Assert::ActualValue
|
|
205
224
|
assert_calls(
|
206
225
|
:assert_not_same,
|
207
226
|
when_calling: [:is_not, "something"],
|
208
|
-
on_value: actual_value1
|
227
|
+
on_value: actual_value1,
|
209
228
|
) do |value, call|
|
210
229
|
assert_equal ["something", value, *args1], call.args
|
211
230
|
end
|
@@ -213,7 +232,7 @@ class Assert::ActualValue
|
|
213
232
|
assert_calls(
|
214
233
|
:assert_equal,
|
215
234
|
when_calling: [:equals, "something"],
|
216
|
-
on_value: actual_value1
|
235
|
+
on_value: actual_value1,
|
217
236
|
) do |value, call|
|
218
237
|
assert_equal ["something", value, *args1], call.args
|
219
238
|
end
|
@@ -221,7 +240,7 @@ class Assert::ActualValue
|
|
221
240
|
assert_calls(
|
222
241
|
:assert_equal,
|
223
242
|
when_calling: [:is_equal_to, "something"],
|
224
|
-
on_value: actual_value1
|
243
|
+
on_value: actual_value1,
|
225
244
|
) do |value, call|
|
226
245
|
assert_equal ["something", value, *args1], call.args
|
227
246
|
end
|
@@ -229,7 +248,7 @@ class Assert::ActualValue
|
|
229
248
|
assert_calls(
|
230
249
|
:assert_not_equal,
|
231
250
|
when_calling: [:does_not_equal, "something"],
|
232
|
-
on_value: actual_value1
|
251
|
+
on_value: actual_value1,
|
233
252
|
) do |value, call|
|
234
253
|
assert_equal ["something", value, *args1], call.args
|
235
254
|
end
|
@@ -237,7 +256,7 @@ class Assert::ActualValue
|
|
237
256
|
assert_calls(
|
238
257
|
:assert_not_equal,
|
239
258
|
when_calling: [:is_not_equal_to, "something"],
|
240
|
-
on_value: actual_value1
|
259
|
+
on_value: actual_value1,
|
241
260
|
) do |value, call|
|
242
261
|
assert_equal ["something", value, *args1], call.args
|
243
262
|
end
|
@@ -245,7 +264,7 @@ class Assert::ActualValue
|
|
245
264
|
assert_calls(
|
246
265
|
:assert_match,
|
247
266
|
when_calling: [:matches, "something"],
|
248
|
-
on_value: actual_value1
|
267
|
+
on_value: actual_value1,
|
249
268
|
) do |value, call|
|
250
269
|
assert_equal ["something", value, *args1], call.args
|
251
270
|
end
|
@@ -253,7 +272,7 @@ class Assert::ActualValue
|
|
253
272
|
assert_calls(
|
254
273
|
:assert_not_match,
|
255
274
|
when_calling: [:does_not_match, "something"],
|
256
|
-
on_value: actual_value1
|
275
|
+
on_value: actual_value1,
|
257
276
|
) do |value, call|
|
258
277
|
assert_equal ["something", value, *args1], call.args
|
259
278
|
end
|
@@ -261,7 +280,7 @@ class Assert::ActualValue
|
|
261
280
|
assert_calls(
|
262
281
|
:assert_empty,
|
263
282
|
when_calling: :is_empty,
|
264
|
-
on_value: actual_value1
|
283
|
+
on_value: actual_value1,
|
265
284
|
) do |value, call|
|
266
285
|
assert_equal [value, *args1], call.args
|
267
286
|
end
|
@@ -269,7 +288,7 @@ class Assert::ActualValue
|
|
269
288
|
assert_calls(
|
270
289
|
:assert_not_empty,
|
271
290
|
when_calling: :is_not_empty,
|
272
|
-
on_value: actual_value1
|
291
|
+
on_value: actual_value1,
|
273
292
|
) do |value, call|
|
274
293
|
assert_equal [value, *args1], call.args
|
275
294
|
end
|
@@ -277,7 +296,7 @@ class Assert::ActualValue
|
|
277
296
|
assert_calls(
|
278
297
|
:assert_includes,
|
279
298
|
when_calling: [:includes, "something"],
|
280
|
-
on_value: actual_value1
|
299
|
+
on_value: actual_value1,
|
281
300
|
) do |value, call|
|
282
301
|
assert_equal ["something", value, *args1], call.args
|
283
302
|
end
|
@@ -285,7 +304,7 @@ class Assert::ActualValue
|
|
285
304
|
assert_calls(
|
286
305
|
:assert_not_includes,
|
287
306
|
when_calling: [:does_not_include, "something"],
|
288
|
-
on_value: actual_value1
|
307
|
+
on_value: actual_value1,
|
289
308
|
) do |value, call|
|
290
309
|
assert_equal ["something", value, *args1], call.args
|
291
310
|
end
|
@@ -293,7 +312,7 @@ class Assert::ActualValue
|
|
293
312
|
assert_calls(
|
294
313
|
:assert_nil,
|
295
314
|
when_calling: :is_nil,
|
296
|
-
on_value: actual_value1
|
315
|
+
on_value: actual_value1,
|
297
316
|
) do |value, call|
|
298
317
|
assert_equal [value, *args1], call.args
|
299
318
|
end
|
@@ -301,7 +320,7 @@ class Assert::ActualValue
|
|
301
320
|
assert_calls(
|
302
321
|
:assert_not_nil,
|
303
322
|
when_calling: :is_not_nil,
|
304
|
-
on_value: actual_value1
|
323
|
+
on_value: actual_value1,
|
305
324
|
) do |value, call|
|
306
325
|
assert_equal [value, *args1], call.args
|
307
326
|
end
|
@@ -309,7 +328,7 @@ class Assert::ActualValue
|
|
309
328
|
assert_calls(
|
310
329
|
:assert_true,
|
311
330
|
when_calling: :is_true,
|
312
|
-
on_value: actual_value1
|
331
|
+
on_value: actual_value1,
|
313
332
|
) do |value, call|
|
314
333
|
assert_equal [value, *args1], call.args
|
315
334
|
end
|
@@ -317,7 +336,7 @@ class Assert::ActualValue
|
|
317
336
|
assert_calls(
|
318
337
|
:assert_not_true,
|
319
338
|
when_calling: :is_not_true,
|
320
|
-
on_value: actual_value1
|
339
|
+
on_value: actual_value1,
|
321
340
|
) do |value, call|
|
322
341
|
assert_equal [value, *args1], call.args
|
323
342
|
end
|
@@ -325,7 +344,7 @@ class Assert::ActualValue
|
|
325
344
|
assert_calls(
|
326
345
|
:assert_false,
|
327
346
|
when_calling: :is_false,
|
328
|
-
on_value: actual_value1
|
347
|
+
on_value: actual_value1,
|
329
348
|
) do |value, call|
|
330
349
|
assert_equal [value, *args1], call.args
|
331
350
|
end
|
@@ -333,7 +352,7 @@ class Assert::ActualValue
|
|
333
352
|
assert_calls(
|
334
353
|
:assert_not_false,
|
335
354
|
when_calling: :is_not_false,
|
336
|
-
on_value: actual_value1
|
355
|
+
on_value: actual_value1,
|
337
356
|
) do |value, call|
|
338
357
|
assert_equal [value, *args1], call.args
|
339
358
|
end
|
@@ -341,7 +360,7 @@ class Assert::ActualValue
|
|
341
360
|
assert_calls(
|
342
361
|
:assert_file_exists,
|
343
362
|
when_calling: :is_a_file,
|
344
|
-
on_value: actual_value1
|
363
|
+
on_value: actual_value1,
|
345
364
|
) do |value, call|
|
346
365
|
assert_equal [value, *args1], call.args
|
347
366
|
end
|
@@ -349,7 +368,7 @@ class Assert::ActualValue
|
|
349
368
|
assert_calls(
|
350
369
|
:assert_not_file_exists,
|
351
370
|
when_calling: :is_not_a_file,
|
352
|
-
on_value: actual_value1
|
371
|
+
on_value: actual_value1,
|
353
372
|
) do |value, call|
|
354
373
|
assert_equal [value, *args1], call.args
|
355
374
|
end
|
@@ -361,7 +380,9 @@ class Assert::ActualValue
|
|
361
380
|
@last_call = nil
|
362
381
|
Assert.stub_on_call(context1, context_method, &capture_last_call_block)
|
363
382
|
|
364
|
-
unit_class
|
383
|
+
unit_class
|
384
|
+
.new(on_value, context: context1)
|
385
|
+
.public_send(*when_calling, *args1)
|
365
386
|
yield(on_value, @last_call)
|
366
387
|
|
367
388
|
Assert.unstub(context1, context_method)
|