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