assert 2.19.1 → 2.19.6
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -8,18 +8,22 @@ require "assert/suite"
|
|
8
8
|
class Assert::DefaultSuite
|
9
9
|
class UnitTests < Assert::Context
|
10
10
|
desc "Assert::DefaultSuite"
|
11
|
-
subject
|
11
|
+
subject{ unit_class }
|
12
12
|
|
13
|
-
let(:unit_class)
|
13
|
+
let(:unit_class){ Assert::DefaultSuite }
|
14
14
|
end
|
15
15
|
|
16
16
|
class InitTests < UnitTests
|
17
17
|
desc "when init"
|
18
|
-
subject
|
18
|
+
subject{ unit_class.new(config1) }
|
19
19
|
|
20
|
-
let(:ci1)
|
21
|
-
let(:test1)
|
22
|
-
let(:config1)
|
20
|
+
let(:ci1){ Factory.context_info(Factory.modes_off_context_class) }
|
21
|
+
let(:test1){ Factory.test(Factory.string, ci1){} }
|
22
|
+
let(:config1){ Factory.modes_off_config }
|
23
|
+
|
24
|
+
should have_readers :test_count, :result_count, :pass_result_count
|
25
|
+
should have_readers :fail_result_count, :error_result_count
|
26
|
+
should have_readers :skip_result_count, :ignore_result_count
|
23
27
|
|
24
28
|
should "be a Suite" do
|
25
29
|
assert_that(subject).is_kind_of(Assert::Suite)
|
data/test/unit/factory_tests.rb
CHANGED
@@ -8,9 +8,9 @@ require "much-factory"
|
|
8
8
|
module Assert::Factory
|
9
9
|
class UnitTests < Assert::Context
|
10
10
|
desc "Assert::Factory"
|
11
|
-
subject
|
11
|
+
subject{ unit_class }
|
12
12
|
|
13
|
-
let(:unit_class)
|
13
|
+
let(:unit_class){ Assert::Factory }
|
14
14
|
|
15
15
|
should "include and extend MuchFactory" do
|
16
16
|
assert_that(subject).includes(MuchFactory)
|
@@ -6,19 +6,19 @@ require "assert/file_line"
|
|
6
6
|
class Assert::FileLine
|
7
7
|
class UnitTests < Assert::Context
|
8
8
|
desc "Assert::FileLine"
|
9
|
-
subject
|
9
|
+
subject{ unit_class }
|
10
10
|
|
11
|
-
let(:unit_class)
|
11
|
+
let(:unit_class){ Assert::FileLine }
|
12
12
|
|
13
|
-
let(:file1)
|
14
|
-
let(:line1)
|
13
|
+
let(:file1){ "#{Factory.path}_tests.rb" }
|
14
|
+
let(:line1){ Factory.integer.to_s }
|
15
15
|
|
16
16
|
should have_imeths :parse
|
17
17
|
|
18
18
|
should "know how to parse and init from a file line path string" do
|
19
19
|
file_line_path = [
|
20
20
|
"#{file1}:#{line1}",
|
21
|
-
"#{file1}:#{line1} #{Factory.string}"
|
21
|
+
"#{file1}:#{line1} #{Factory.string}",
|
22
22
|
].sample
|
23
23
|
file_line = subject.parse(file_line_path)
|
24
24
|
|
@@ -47,7 +47,7 @@ class Assert::FileLine
|
|
47
47
|
|
48
48
|
class InitTests < UnitTests
|
49
49
|
desc "when init"
|
50
|
-
subject
|
50
|
+
subject{ unit_class.new(file1, line1) }
|
51
51
|
|
52
52
|
should have_readers :file, :line
|
53
53
|
|
@@ -73,7 +73,7 @@ class Assert::FileLine
|
|
73
73
|
no = unit_class.new("#{Factory.path}_tests.rb", Factory.integer.to_s)
|
74
74
|
|
75
75
|
assert_that(subject).equals(yes)
|
76
|
-
assert_not_equal no,
|
76
|
+
assert_not_equal no, subject
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
data/test/unit/macro_tests.rb
CHANGED
@@ -6,14 +6,14 @@ require "assert/macro"
|
|
6
6
|
class Assert::Macro
|
7
7
|
class UnitTests < Assert::Context
|
8
8
|
desc "Assert::Macro"
|
9
|
-
subject
|
9
|
+
subject{ unit_class }
|
10
10
|
|
11
|
-
let(:unit_class)
|
11
|
+
let(:unit_class){ Assert::Macro }
|
12
12
|
end
|
13
13
|
|
14
14
|
class InitTests < UnitTests
|
15
15
|
desc "when init"
|
16
|
-
subject
|
16
|
+
subject{ unit_class.new{} }
|
17
17
|
|
18
18
|
should "have an accessor for its (optional) name" do
|
19
19
|
assert_that(subject).responds_to(:name)
|
@@ -21,11 +21,11 @@ class Assert::Macro
|
|
21
21
|
end
|
22
22
|
|
23
23
|
should "default its name if no given" do
|
24
|
-
assert_that((unit_class.new
|
24
|
+
assert_that((unit_class.new{}).name).equals("run this macro")
|
25
25
|
end
|
26
26
|
|
27
27
|
should "initialize with a given name" do
|
28
|
-
assert_that((unit_class.new("test")
|
28
|
+
assert_that((unit_class.new("test"){}).name).equals("test")
|
29
29
|
end
|
30
30
|
|
31
31
|
should "be a Proc" do
|
@@ -33,7 +33,7 @@ class Assert::Macro
|
|
33
33
|
end
|
34
34
|
|
35
35
|
should "complain if you create a macro without a block" do
|
36
|
-
assert_that
|
36
|
+
assert_that{ unit_class.new }.raises(ArgumentError)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -41,7 +41,7 @@ class Assert::Macro
|
|
41
41
|
desc "have_instance_methods macro: this class"
|
42
42
|
subject do
|
43
43
|
class ::InstExample
|
44
|
-
(1..6).each
|
44
|
+
(1..6).each{ |i| define_method("method_#{i}"){} }
|
45
45
|
end
|
46
46
|
::InstExample.new
|
47
47
|
end
|
@@ -62,7 +62,7 @@ class Assert::Macro
|
|
62
62
|
subject do
|
63
63
|
class ::ClassExample
|
64
64
|
class << self
|
65
|
-
(1..6).each
|
65
|
+
(1..6).each{ |i| define_method("method_#{i}"){} }
|
66
66
|
end
|
67
67
|
end
|
68
68
|
::ClassExample.new
|
@@ -83,7 +83,7 @@ class Assert::Macro
|
|
83
83
|
desc "have_readers macro: this class"
|
84
84
|
subject do
|
85
85
|
class ::ReaderExample
|
86
|
-
(1..6).each
|
86
|
+
(1..6).each{ |i| attr_reader "method_#{i}" }
|
87
87
|
end
|
88
88
|
::ReaderExample.new
|
89
89
|
end
|
@@ -103,7 +103,7 @@ class Assert::Macro
|
|
103
103
|
desc "have_writers macro: this class"
|
104
104
|
subject do
|
105
105
|
class ::WriterExample
|
106
|
-
(1..6).each
|
106
|
+
(1..6).each{ |i| attr_writer "method_#{i}" }
|
107
107
|
end
|
108
108
|
::WriterExample.new
|
109
109
|
end
|
@@ -123,7 +123,7 @@ class Assert::Macro
|
|
123
123
|
desc "have_accessors macro: this class"
|
124
124
|
subject do
|
125
125
|
class ::AccessorExample
|
126
|
-
(1..6).each
|
126
|
+
(1..6).each{ |i| attr_accessor "method_#{i}" }
|
127
127
|
end
|
128
128
|
::AccessorExample.new
|
129
129
|
end
|
data/test/unit/result_tests.rb
CHANGED
@@ -8,22 +8,23 @@ require "assert/file_line"
|
|
8
8
|
module Assert::Result
|
9
9
|
class UnitTests < Assert::Context
|
10
10
|
desc "Assert::Result"
|
11
|
-
subject
|
11
|
+
subject{ unit_class }
|
12
12
|
|
13
|
-
let(:unit_class)
|
13
|
+
let(:unit_class){ Assert::Result }
|
14
14
|
|
15
|
-
let(:test1)
|
15
|
+
let(:test1){ Factory.test("a test name") }
|
16
16
|
|
17
17
|
should have_imeths :types, :new
|
18
18
|
|
19
19
|
should "know its types" do
|
20
|
-
exp =
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
exp =
|
21
|
+
{
|
22
|
+
pass: Pass,
|
23
|
+
fail: Fail,
|
24
|
+
ignore: Ignore,
|
25
|
+
skip: Skip,
|
26
|
+
error: Error,
|
27
|
+
}
|
27
28
|
assert_that(subject.types).equals(exp)
|
28
29
|
|
29
30
|
assert_that(subject.types[Factory.string]).equals(Base)
|
@@ -31,26 +32,26 @@ module Assert::Result
|
|
31
32
|
|
32
33
|
should "create results from data hashes" do
|
33
34
|
type = Assert::Result.types.keys.sample
|
34
|
-
exp = Assert::Result.types[type].new(:
|
35
|
-
assert_that(Assert::Result.new(:
|
35
|
+
exp = Assert::Result.types[type].new(type: type)
|
36
|
+
assert_that(Assert::Result.new(type: type)).equals(exp)
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
39
40
|
class InitBaseTests < UnitTests
|
40
41
|
desc "Base when init"
|
41
|
-
subject
|
42
|
+
subject{ Base.new(given_data1) }
|
42
43
|
|
43
|
-
let(:given_data1)
|
44
|
+
let(:given_data1) do
|
44
45
|
{
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
46
|
+
type: Factory.string,
|
47
|
+
name: Factory.string,
|
48
|
+
test_name: Factory.string,
|
49
|
+
test_file_line: Assert::FileLine.new(Factory.string, Factory.integer),
|
50
|
+
message: Factory.string,
|
51
|
+
output: Factory.text,
|
52
|
+
backtrace: Backtrace.new(Factory.backtrace),
|
52
53
|
}
|
53
|
-
|
54
|
+
end
|
54
55
|
|
55
56
|
should have_cmeths :type, :name, :for_test
|
56
57
|
should have_imeths :type, :name, :test_name, :test_file_line
|
@@ -124,10 +125,11 @@ module Assert::Result
|
|
124
125
|
assert_that(subject.trace).equals(exp_trace)
|
125
126
|
|
126
127
|
# test that the first bt line is used if filtered is empty
|
127
|
-
assert_lib_path =
|
128
|
-
|
129
|
-
|
130
|
-
|
128
|
+
assert_lib_path =
|
129
|
+
File.join(ROOT_PATH, "lib/#{Factory.string}:#{Factory.integer}")
|
130
|
+
new_bt = (Factory.integer(3) + 1).times.map{ assert_lib_path }
|
131
|
+
exp_backtrace = Backtrace.new(new_bt)
|
132
|
+
exp_trace = exp_backtrace.first.to_s
|
131
133
|
subject.set_backtrace(new_bt)
|
132
134
|
assert_that(subject.backtrace).equals(exp_backtrace)
|
133
135
|
assert_that(subject.trace).equals(exp_trace)
|
@@ -171,8 +173,9 @@ module Assert::Result
|
|
171
173
|
assert_that(subject.line_num).equals(exp.line.to_i)
|
172
174
|
|
173
175
|
# test that the first bt line is used if filtered is empty
|
174
|
-
assert_lib_path =
|
175
|
-
|
176
|
+
assert_lib_path =
|
177
|
+
File.join(ROOT_PATH, "lib/#{Factory.string}:#{Factory.integer}")
|
178
|
+
new_bt = (Factory.integer(3) + 1).times.map{ assert_lib_path }
|
176
179
|
subject.set_backtrace(new_bt)
|
177
180
|
|
178
181
|
exp = new_bt.first.to_s
|
@@ -231,7 +234,7 @@ module Assert::Result
|
|
231
234
|
|
232
235
|
class InitPassTests < UnitTests
|
233
236
|
desc "Pass when init"
|
234
|
-
subject
|
237
|
+
subject{ Pass.new({}) }
|
235
238
|
|
236
239
|
should "know its type/name" do
|
237
240
|
assert_that(subject.type).equals(:pass)
|
@@ -242,7 +245,7 @@ module Assert::Result
|
|
242
245
|
|
243
246
|
class InitIgnoreTests < UnitTests
|
244
247
|
desc "Ignore when init"
|
245
|
-
subject
|
248
|
+
subject{ Ignore.new({}) }
|
246
249
|
|
247
250
|
should "know its type/name" do
|
248
251
|
assert_that(subject.type).equals(:ignore)
|
@@ -253,7 +256,7 @@ module Assert::Result
|
|
253
256
|
|
254
257
|
class InitHaltingTestResultErrorTests < UnitTests
|
255
258
|
desc "HaltingTestResultError when init"
|
256
|
-
subject
|
259
|
+
subject{ HaltingTestResultError.new }
|
257
260
|
|
258
261
|
should have_accessors :assert_with_bt
|
259
262
|
|
@@ -264,7 +267,7 @@ module Assert::Result
|
|
264
267
|
|
265
268
|
class InitTestFailureTests < UnitTests
|
266
269
|
desc "TestFailure when init"
|
267
|
-
subject
|
270
|
+
subject{ TestFailure.new }
|
268
271
|
|
269
272
|
should "be a halting test result error" do
|
270
273
|
assert_that(subject).is_kind_of(HaltingTestResultError)
|
@@ -273,7 +276,7 @@ module Assert::Result
|
|
273
276
|
|
274
277
|
class InitFailTests < UnitTests
|
275
278
|
desc "Fail when init"
|
276
|
-
subject
|
279
|
+
subject{ Fail.new({}) }
|
277
280
|
|
278
281
|
should "know its type/name" do
|
279
282
|
assert_that(subject.type).equals(:fail)
|
@@ -304,13 +307,14 @@ module Assert::Result
|
|
304
307
|
end
|
305
308
|
|
306
309
|
should "not allow creating for a test with non-TestFailure exceptions" do
|
307
|
-
assert_that
|
310
|
+
assert_that{ Fail.for_test(test1, RuntimeError.new) }
|
311
|
+
.raises(ArgumentError)
|
308
312
|
end
|
309
313
|
end
|
310
314
|
|
311
315
|
class InitTestSkippedTests < UnitTests
|
312
316
|
desc "TestSkipped when init"
|
313
|
-
subject
|
317
|
+
subject{ TestSkipped.new }
|
314
318
|
|
315
319
|
should "be a halting test result error" do
|
316
320
|
assert_that(subject).is_kind_of(HaltingTestResultError)
|
@@ -319,7 +323,7 @@ module Assert::Result
|
|
319
323
|
|
320
324
|
class InitSkipTests < UnitTests
|
321
325
|
desc "Skip when init"
|
322
|
-
subject
|
326
|
+
subject{ Skip.new({}) }
|
323
327
|
|
324
328
|
should "know its type/name" do
|
325
329
|
assert_that(subject.type).equals(:skip)
|
@@ -350,13 +354,14 @@ module Assert::Result
|
|
350
354
|
end
|
351
355
|
|
352
356
|
should "not allow creating for a test with non-TestSkipped exceptions" do
|
353
|
-
assert_that
|
357
|
+
assert_that{ Skip.for_test(test1, RuntimeError.new) }
|
358
|
+
.raises(ArgumentError)
|
354
359
|
end
|
355
360
|
end
|
356
361
|
|
357
362
|
class InitErrorTests < UnitTests
|
358
363
|
desc "Error when init"
|
359
|
-
subject
|
364
|
+
subject{ Error.new({}) }
|
360
365
|
|
361
366
|
should "know its class-level type/name" do
|
362
367
|
assert_that(subject.class.type).equals(:error)
|
@@ -377,13 +382,13 @@ module Assert::Result
|
|
377
382
|
end
|
378
383
|
|
379
384
|
should "not allow creating for a test without an exception" do
|
380
|
-
assert_that
|
385
|
+
assert_that{ Error.for_test(test1, Factory.string) }.raises(ArgumentError)
|
381
386
|
end
|
382
387
|
end
|
383
388
|
|
384
389
|
class InitBacktraceTests < UnitTests
|
385
390
|
desc "Backtrace when init"
|
386
|
-
subject
|
391
|
+
subject{ Backtrace.new(Factory.backtrace) }
|
387
392
|
|
388
393
|
should have_cmeths :parse, :to_s
|
389
394
|
should have_imeths :filtered
|
@@ -393,7 +398,8 @@ module Assert::Result
|
|
393
398
|
end
|
394
399
|
|
395
400
|
should "render as a string by joining on the newline" do
|
396
|
-
assert_that(Backtrace.to_s(subject))
|
401
|
+
assert_that(Backtrace.to_s(subject))
|
402
|
+
.equals(subject.join(Backtrace::DELIM))
|
397
403
|
end
|
398
404
|
|
399
405
|
should "be an Array" do
|
data/test/unit/runner_tests.rb
CHANGED
@@ -12,9 +12,9 @@ require "assert/view"
|
|
12
12
|
class Assert::Runner
|
13
13
|
class UnitTests < Assert::Context
|
14
14
|
desc "Assert::Runner"
|
15
|
-
subject
|
15
|
+
subject{ unit_class }
|
16
16
|
|
17
|
-
let(:unit_class)
|
17
|
+
let(:unit_class){ Assert::Runner }
|
18
18
|
|
19
19
|
should "include the config helpers" do
|
20
20
|
assert_that(subject).includes(Assert::ConfigHelpers)
|
@@ -23,14 +23,14 @@ class Assert::Runner
|
|
23
23
|
|
24
24
|
class InitTests < UnitTests
|
25
25
|
desc "when init"
|
26
|
-
subject
|
26
|
+
subject{ unit_class.new(config1) }
|
27
27
|
|
28
28
|
setup do
|
29
29
|
config1.suite Assert::DefaultSuite.new(config1)
|
30
30
|
config1.view Assert::View.new(config1, StringIO.new(+"", "w+"))
|
31
31
|
end
|
32
32
|
|
33
|
-
let(:config1)
|
33
|
+
let(:config1){ Factory.modes_off_config }
|
34
34
|
|
35
35
|
should have_readers :config
|
36
36
|
should have_imeths :runner, :run
|
@@ -49,7 +49,7 @@ class Assert::Runner
|
|
49
49
|
|
50
50
|
class RunTests < InitTests
|
51
51
|
desc "and run"
|
52
|
-
subject
|
52
|
+
subject{ runner_class1.new(config1) }
|
53
53
|
|
54
54
|
setup do
|
55
55
|
@view_output = +""
|
@@ -64,9 +64,13 @@ class Assert::Runner
|
|
64
64
|
@result_count = subject.run
|
65
65
|
end
|
66
66
|
|
67
|
-
let(:runner_class1)
|
68
|
-
|
69
|
-
|
67
|
+
let(:runner_class1) do
|
68
|
+
Class.new(unit_class){ include CallbackMixin }
|
69
|
+
end
|
70
|
+
let(:ci1){ Factory.context_info(Factory.modes_off_context_class) }
|
71
|
+
# rubocop:disable Lint/BinaryOperatorWithIdenticalOperands
|
72
|
+
let(:test1){ Factory.test("should pass", ci1){ assert(1 == 1) } }
|
73
|
+
# rubocop:enable Lint/BinaryOperatorWithIdenticalOperands
|
70
74
|
|
71
75
|
should "return the fail+error result count as an integer exit code" do
|
72
76
|
assert_that(@result_count).equals(0)
|
@@ -75,7 +79,7 @@ class Assert::Runner
|
|
75
79
|
error_count = Factory.integer
|
76
80
|
Assert.stub(subject, :fail_result_count){ fail_count }
|
77
81
|
Assert.stub(subject, :error_result_count){ error_count }
|
78
|
-
Assert.stub(test1, :run){
|
82
|
+
Assert.stub(test1, :run){} # no-op
|
79
83
|
result_count = subject.run
|
80
84
|
|
81
85
|
assert_that(result_count).equals(fail_count + error_count)
|
@@ -85,7 +89,8 @@ class Assert::Runner
|
|
85
89
|
# itself
|
86
90
|
assert_that(subject.on_start_called).is_true
|
87
91
|
assert_that(subject.before_test_called).equals([test1])
|
88
|
-
assert_that(subject.on_result_called.last)
|
92
|
+
assert_that(subject.on_result_called.last)
|
93
|
+
.is_instance_of(Assert::Result::Pass)
|
89
94
|
assert_that(subject.after_test_called).equals([test1])
|
90
95
|
assert_that(subject.on_finish_called).is_true
|
91
96
|
|
@@ -93,7 +98,8 @@ class Assert::Runner
|
|
93
98
|
suite = config1.suite
|
94
99
|
assert_that(suite.on_start_called).is_true
|
95
100
|
assert_that(suite.before_test_called).equals([test1])
|
96
|
-
assert_that(suite.on_result_called.last)
|
101
|
+
assert_that(suite.on_result_called.last)
|
102
|
+
.is_instance_of(Assert::Result::Pass)
|
97
103
|
assert_that(suite.after_test_called).equals([test1])
|
98
104
|
assert_that(suite.on_finish_called).is_true
|
99
105
|
|
@@ -101,7 +107,8 @@ class Assert::Runner
|
|
101
107
|
view = config1.view
|
102
108
|
assert_that(view.on_start_called).is_true
|
103
109
|
assert_that(view.before_test_called).equals([test1])
|
104
|
-
assert_that(view.on_result_called.last)
|
110
|
+
assert_that(view.on_result_called.last)
|
111
|
+
.is_instance_of(Assert::Result::Pass)
|
105
112
|
assert_that(view.after_test_called).equals([test1])
|
106
113
|
assert_that(view.on_finish_called).is_true
|
107
114
|
end
|
@@ -118,7 +125,9 @@ class Assert::Runner
|
|
118
125
|
end
|
119
126
|
|
120
127
|
should "run only a single test if a single test is configured" do
|
121
|
-
|
128
|
+
# rubocop:disable Lint/BinaryOperatorWithIdenticalOperands
|
129
|
+
test = Factory.test("should pass", ci1){ assert(1 == 1) }
|
130
|
+
# rubocop:enable Lint/BinaryOperatorWithIdenticalOperands
|
122
131
|
config1.suite.clear_tests_to_run
|
123
132
|
config1.suite.on_test(test)
|
124
133
|
config1.single_test test.file_line.to_s
|
@@ -127,8 +136,11 @@ class Assert::Runner
|
|
127
136
|
assert_that(runner.before_test_called).equals([test])
|
128
137
|
end
|
129
138
|
|
130
|
-
should "not run any tests if a single test is configured but
|
131
|
-
|
139
|
+
should "not run any tests if a single test is configured but "\
|
140
|
+
"can't be found" do
|
141
|
+
# rubocop:disable Lint/BinaryOperatorWithIdenticalOperands
|
142
|
+
test = Factory.test("should pass", ci1){ assert(1 == 1) }
|
143
|
+
# rubocop:enable Lint/BinaryOperatorWithIdenticalOperands
|
132
144
|
config1.suite.clear_tests_to_run
|
133
145
|
config1.suite.on_test(test)
|
134
146
|
config1.single_test Factory.string
|
@@ -137,7 +149,8 @@ class Assert::Runner
|
|
137
149
|
assert_that(runner.before_test_called).is_nil
|
138
150
|
end
|
139
151
|
|
140
|
-
should "describe running only a single test if a single test is
|
152
|
+
should "describe running only a single test if a single test is "\
|
153
|
+
"configured" do
|
141
154
|
config1.suite.clear_tests_to_run
|
142
155
|
config1.suite.on_test(test1)
|
143
156
|
config1.single_test test1.file_line.to_s
|