assert 2.18.2 → 2.18.3
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/README.md +7 -6
- data/assert.gemspec +1 -1
- data/lib/assert/actual_value.rb +127 -0
- data/lib/assert/assertions.rb +11 -20
- data/lib/assert/context.rb +13 -5
- data/lib/assert/context/let_dsl.rb +13 -0
- data/lib/assert/context/method_missing.rb +19 -0
- data/lib/assert/macros/methods.rb +4 -4
- data/lib/assert/stub.rb +4 -0
- data/lib/assert/version.rb +1 -1
- data/test/helper.rb +23 -25
- data/test/support/factory.rb +15 -0
- data/test/system/stub_tests.rb +348 -333
- data/test/system/test_tests.rb +111 -109
- data/test/unit/actual_value_tests.rb +335 -0
- data/test/unit/assert_tests.rb +84 -59
- data/test/unit/assertions/assert_block_tests.rb +32 -31
- data/test/unit/assertions/assert_empty_tests.rb +35 -32
- data/test/unit/assertions/assert_equal_tests.rb +81 -75
- data/test/unit/assertions/assert_file_exists_tests.rb +34 -33
- data/test/unit/assertions/assert_includes_tests.rb +40 -37
- data/test/unit/assertions/assert_instance_of_tests.rb +36 -33
- data/test/unit/assertions/assert_kind_of_tests.rb +36 -33
- data/test/unit/assertions/assert_match_tests.rb +36 -33
- data/test/unit/assertions/assert_nil_tests.rb +32 -31
- data/test/unit/assertions/assert_raises_tests.rb +55 -55
- data/test/unit/assertions/assert_respond_to_tests.rb +38 -35
- data/test/unit/assertions/assert_same_tests.rb +91 -80
- data/test/unit/assertions/assert_true_false_tests.rb +64 -60
- data/test/unit/assertions_tests.rb +15 -13
- data/test/unit/config_helpers_tests.rb +36 -35
- data/test/unit/config_tests.rb +33 -34
- data/test/unit/context/let_dsl_tests.rb +10 -0
- data/test/unit/context/setup_dsl_tests.rb +70 -81
- data/test/unit/context/subject_dsl_tests.rb +16 -43
- data/test/unit/context/suite_dsl_tests.rb +16 -16
- data/test/unit/context/test_dsl_tests.rb +50 -54
- data/test/unit/context_info_tests.rb +16 -15
- data/test/unit/context_tests.rb +170 -157
- data/test/unit/default_runner_tests.rb +2 -5
- data/test/unit/default_suite_tests.rb +51 -53
- data/test/unit/factory_tests.rb +3 -3
- data/test/unit/file_line_tests.rb +31 -33
- data/test/unit/macro_tests.rb +9 -10
- data/test/unit/result_tests.rb +150 -163
- data/test/unit/runner_tests.rb +63 -63
- data/test/unit/suite_tests.rb +57 -54
- data/test/unit/test_tests.rb +134 -126
- data/test/unit/utils_tests.rb +41 -45
- data/test/unit/view_helpers_tests.rb +55 -52
- data/test/unit/view_tests.rb +20 -22
- metadata +11 -4
@@ -4,77 +4,65 @@ require "assert/context/setup_dsl"
|
|
4
4
|
module Assert::Context::SetupDSL
|
5
5
|
class UnitTests < Assert::Context
|
6
6
|
desc "Assert::Context::SetupDSL"
|
7
|
-
subject{
|
7
|
+
subject { context_class1 }
|
8
|
+
|
9
|
+
let(:block1) { ::Proc.new {} }
|
10
|
+
let(:context_class1) { Factory.modes_off_context_class }
|
8
11
|
end
|
9
12
|
|
10
13
|
class SetupTeardownOnceMethodsTests < UnitTests
|
11
14
|
desc "once methods"
|
12
|
-
setup do
|
13
|
-
block = @block = ::Proc.new{ something_once = true }
|
14
|
-
@context_class = Factory.modes_off_context_class do
|
15
|
-
setup_once(&block)
|
16
|
-
teardown_once(&block)
|
17
|
-
end
|
18
|
-
end
|
19
15
|
|
20
16
|
should "add the block to the suite" do
|
21
|
-
|
22
|
-
|
17
|
+
subject.setup_once(&block1)
|
18
|
+
subject.teardown_once(&block1)
|
19
|
+
|
20
|
+
assert_that(subject.suite.send(:setups)).includes(block1)
|
21
|
+
assert_that(subject.suite.send(:teardowns)).includes(block1)
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
26
25
|
class SetupTeardownMethodsTests < UnitTests
|
27
26
|
desc "methods"
|
28
|
-
setup do
|
29
|
-
block = @block = ::Proc.new{ something = true }
|
30
|
-
@context_class = Factory.modes_off_context_class do
|
31
|
-
setup(&block)
|
32
|
-
teardown(&block)
|
33
|
-
end
|
34
|
-
end
|
35
27
|
|
36
28
|
should "add the block to the context" do
|
37
|
-
|
38
|
-
|
29
|
+
subject.setup(&block1)
|
30
|
+
subject.teardown(&block1)
|
31
|
+
|
32
|
+
assert_that(subject.send(:setups)).includes(block1)
|
33
|
+
assert_that(subject.send(:teardowns)).includes(block1)
|
39
34
|
end
|
40
35
|
end
|
41
36
|
|
42
37
|
class SetupTeardownWithMethodNameTests < UnitTests
|
43
38
|
desc "methods given a method name"
|
44
|
-
|
45
|
-
|
46
|
-
@context_class = Factory.modes_off_context_class do
|
47
|
-
setup(method_name)
|
48
|
-
teardown(method_name)
|
49
|
-
end
|
50
|
-
end
|
39
|
+
|
40
|
+
let(:method_name1) { :something_amazing }
|
51
41
|
|
52
42
|
should "add the method name to the context" do
|
53
|
-
|
54
|
-
|
43
|
+
subject.setup(method_name1)
|
44
|
+
subject.teardown(method_name1)
|
45
|
+
|
46
|
+
assert_that(subject.send(:setups)).includes(method_name1)
|
47
|
+
assert_that(subject.send(:teardowns)).includes(method_name1)
|
55
48
|
end
|
56
49
|
end
|
57
50
|
|
58
|
-
class
|
51
|
+
class ParentContextClassTests < UnitTests
|
52
|
+
let(:parent_class1) { Factory.modes_off_context_class }
|
53
|
+
let(:context_class1) { Factory.modes_off_context_class(parent_class1) }
|
54
|
+
end
|
55
|
+
|
56
|
+
class SetupTeardownMultipleTests < ParentContextClassTests
|
59
57
|
desc "with multiple calls"
|
60
|
-
setup do
|
61
|
-
parent_setup_block = ::Proc.new{ self.setup_status = "the setup" }
|
62
|
-
parent_teardown_block = ::Proc.new{ self.teardown_status += "the teardown" }
|
63
|
-
@parent_class = Factory.modes_off_context_class do
|
64
|
-
setup(&parent_setup_block)
|
65
|
-
teardown(&parent_teardown_block)
|
66
|
-
end
|
67
58
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
setup(:setup_something)
|
73
|
-
teardown(:teardown_something)
|
74
|
-
teardown(&context_teardown_block)
|
75
|
-
end
|
59
|
+
let(:parent_setup_block1) { ::Proc.new { self.setup_status = "the setup" } }
|
60
|
+
let(:parent_teardown_block1) { ::Proc.new { self.teardown_status += "the teardown" } }
|
61
|
+
let(:context_setup_block1) { ::Proc.new { self.setup_status += " has been run" } }
|
62
|
+
let(:context_teardown_block1) { ::Proc.new { self.teardown_status += "has been run " } }
|
76
63
|
|
77
|
-
|
64
|
+
let(:test_status_class) {
|
65
|
+
Class.new do
|
78
66
|
attr_accessor :setup_status, :teardown_status
|
79
67
|
define_method(:setup_something) do
|
80
68
|
self.setup_status += " with something"
|
@@ -83,57 +71,58 @@ module Assert::Context::SetupDSL
|
|
83
71
|
self.teardown_status = "with something "
|
84
72
|
end
|
85
73
|
end
|
86
|
-
|
74
|
+
}
|
75
|
+
|
76
|
+
should "run its parent and its own blocks in the correct order" do
|
77
|
+
parent_class1.setup(&parent_setup_block1)
|
78
|
+
parent_class1.teardown(&parent_teardown_block1)
|
79
|
+
subject.setup(&context_setup_block1)
|
80
|
+
subject.setup(:setup_something)
|
81
|
+
subject.teardown(:teardown_something)
|
82
|
+
subject.teardown(&context_teardown_block1)
|
87
83
|
|
88
|
-
|
89
|
-
|
90
|
-
assert_equal "the setup has been run with something", obj.setup_status
|
84
|
+
subject.send("run_setups", obj = test_status_class.new)
|
85
|
+
assert_that(obj.setup_status).equals("the setup has been run with something")
|
91
86
|
|
92
|
-
subject.send("run_teardowns", obj =
|
93
|
-
|
87
|
+
subject.send("run_teardowns", obj = test_status_class.new)
|
88
|
+
assert_that(obj.teardown_status).equals("with something has been run the teardown")
|
94
89
|
end
|
95
90
|
end
|
96
91
|
|
97
|
-
class AroundMethodTests <
|
92
|
+
class AroundMethodTests < ParentContextClassTests
|
98
93
|
desc "with multiple `around` calls"
|
99
|
-
setup do
|
100
|
-
@parent_class = Factory.modes_off_context_class do
|
101
|
-
around do |block|
|
102
|
-
self.out_status ||= ""
|
103
|
-
self.out_status += "p-around start, "
|
104
|
-
block.call
|
105
|
-
self.out_status += "p-around end."
|
106
|
-
end
|
107
|
-
end
|
108
94
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
block.call
|
118
|
-
self.out_status += "c-around2 end, "
|
119
|
-
end
|
95
|
+
let(:test_status_class) { Class.new { attr_accessor :out_status } }
|
96
|
+
|
97
|
+
should "run its parent and its own blocks in the correct order" do
|
98
|
+
parent_class1.around do |block|
|
99
|
+
self.out_status ||= ""
|
100
|
+
self.out_status += "p-around start, "
|
101
|
+
block.call
|
102
|
+
self.out_status += "p-around end."
|
120
103
|
end
|
121
104
|
|
122
|
-
|
123
|
-
|
105
|
+
subject.around do |block|
|
106
|
+
self.out_status += "c-around1 start, "
|
107
|
+
block.call
|
108
|
+
self.out_status += "c-around1 end, "
|
109
|
+
end
|
110
|
+
subject.around do |block|
|
111
|
+
self.out_status += "c-around2 start, "
|
112
|
+
block.call
|
113
|
+
self.out_status += "c-around2 end, "
|
124
114
|
end
|
125
|
-
end
|
126
115
|
|
127
|
-
|
128
|
-
obj = @test_status_class.new
|
116
|
+
obj = test_status_class.new
|
129
117
|
subject.send("run_arounds", obj) do
|
130
118
|
obj.instance_eval{ self.out_status += "TEST, " }
|
131
119
|
end
|
132
120
|
|
133
|
-
exp =
|
134
|
-
|
135
|
-
|
136
|
-
|
121
|
+
exp =
|
122
|
+
"p-around start, c-around1 start, c-around2 start, "\
|
123
|
+
"TEST, "\
|
124
|
+
"c-around2 end, c-around1 end, p-around end."
|
125
|
+
assert_that(obj.out_status).equals(exp)
|
137
126
|
end
|
138
127
|
end
|
139
128
|
end
|
@@ -2,71 +2,44 @@ require "assert"
|
|
2
2
|
require "assert/context/subject_dsl"
|
3
3
|
|
4
4
|
module Assert::Context::SubjectDSL
|
5
|
-
|
6
5
|
class UnitTests < Assert::Context
|
7
6
|
desc "Assert::Context::SubjectDSL"
|
8
|
-
subject{
|
9
|
-
end
|
10
|
-
|
11
|
-
class DescriptionsTests < UnitTests
|
12
|
-
desc "`descriptions` method"
|
13
|
-
setup do
|
14
|
-
descs = @descs = ["something amazing", "it really is"]
|
15
|
-
@context_class = Factory.modes_off_context_class do
|
16
|
-
descs.each{ |text| desc text }
|
17
|
-
end
|
18
|
-
end
|
7
|
+
subject { context_class1 }
|
19
8
|
|
20
|
-
|
21
|
-
|
22
|
-
|
9
|
+
let(:parent_class1) { Factory.modes_off_context_class }
|
10
|
+
let(:context_class1) { Factory.modes_off_context_class(parent_class1) }
|
11
|
+
let(:subject_block1) { Proc.new {} }
|
23
12
|
end
|
24
13
|
|
25
14
|
class DescriptionTests < UnitTests
|
26
15
|
desc "`description` method"
|
27
|
-
setup do
|
28
|
-
parent_text = @parent_desc = "parent description"
|
29
|
-
@parent_class = Factory.modes_off_context_class do
|
30
|
-
desc parent_text
|
31
|
-
end
|
32
|
-
text = @desc = "and the description for this context"
|
33
|
-
@context_class = Factory.modes_off_context_class(@parent_class) do
|
34
|
-
desc text
|
35
|
-
end
|
36
|
-
end
|
37
16
|
|
38
17
|
should "return a string of all the inherited descriptions" do
|
39
|
-
|
40
|
-
|
18
|
+
parent_class1.desc("parent description")
|
19
|
+
subject.desc("and the description for this context")
|
20
|
+
|
21
|
+
exp = "parent description and the description for this context"
|
22
|
+
assert_that(subject.description).equals(exp)
|
41
23
|
end
|
42
24
|
end
|
43
25
|
|
44
26
|
class SubjectFromLocalTests < UnitTests
|
45
27
|
desc "`subject` method using local context"
|
46
|
-
setup do
|
47
|
-
subject_block = @subject_block = ::Proc.new{ @something }
|
48
|
-
@context_class = Factory.modes_off_context_class do
|
49
|
-
subject(&subject_block)
|
50
|
-
end
|
51
|
-
end
|
52
28
|
|
53
29
|
should "set the subject block on the context class" do
|
54
|
-
|
30
|
+
subject.subject(&subject_block1)
|
31
|
+
|
32
|
+
assert_that(subject.subject).equals(subject_block1)
|
55
33
|
end
|
56
34
|
end
|
57
35
|
|
58
36
|
class SubjectFromParentTests < UnitTests
|
59
37
|
desc "`subject` method using parent context"
|
60
|
-
setup do
|
61
|
-
parent_block = @parent_block = ::Proc.new{ @something }
|
62
|
-
@parent_class = Factory.modes_off_context_class do
|
63
|
-
subject(&parent_block)
|
64
|
-
end
|
65
|
-
@context_class = Factory.modes_off_context_class(@parent_class)
|
66
|
-
end
|
67
38
|
|
68
|
-
should "default to
|
69
|
-
|
39
|
+
should "default to its parents subject block" do
|
40
|
+
parent_class1.subject(&subject_block1)
|
41
|
+
|
42
|
+
assert_that(subject.subject).equals(subject_block1)
|
70
43
|
end
|
71
44
|
end
|
72
45
|
end
|
@@ -6,38 +6,38 @@ require "assert/suite"
|
|
6
6
|
module Assert::Context::SuiteDSL
|
7
7
|
class UnitTests < Assert::Context
|
8
8
|
desc "Assert::Context::SuiteDSL"
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
subject { context_class1 }
|
10
|
+
|
11
|
+
let(:parent_class1) { Factory.context_class }
|
12
|
+
let(:context_class1) { Factory.context_class(parent_class1) }
|
13
|
+
let(:custom_suite1) { Factory.modes_off_suite }
|
14
14
|
|
15
15
|
should "use `Assert.suite` by default" do
|
16
|
-
|
16
|
+
assert_that(subject.suite).equals(Assert.suite)
|
17
17
|
end
|
18
18
|
|
19
19
|
should "use any given custom suite" do
|
20
|
-
subject.suite(
|
21
|
-
|
20
|
+
subject.suite(custom_suite1)
|
21
|
+
assert_that(subject.suite).equals(custom_suite1)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
class SuiteFromParentTests < UnitTests
|
26
26
|
desc "`suite` method using parent context"
|
27
|
+
|
27
28
|
setup do
|
28
|
-
|
29
|
-
@parent_class.suite(@custom_suite)
|
30
|
-
@context_class = Factory.context_class(@parent_class)
|
29
|
+
parent_class1.suite(custom_suite1)
|
31
30
|
end
|
32
31
|
|
33
|
-
|
34
|
-
|
32
|
+
let(:custom_suite2) { Factory.modes_off_suite }
|
33
|
+
|
34
|
+
should "default to its parent's suite" do
|
35
|
+
assert_that(subject.suite).equals(custom_suite1)
|
35
36
|
end
|
36
37
|
|
37
38
|
should "use any given custom suite" do
|
38
|
-
|
39
|
-
subject.suite(
|
40
|
-
assert_equal another_suite, subject.suite
|
39
|
+
subject.suite(custom_suite2)
|
40
|
+
assert_that(subject.suite).equals(custom_suite2)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -4,148 +4,144 @@ require "assert/context/test_dsl"
|
|
4
4
|
module Assert::Context::TestDSL
|
5
5
|
class UnitTests < Assert::Context
|
6
6
|
desc "Assert::Context::TestDSL"
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
7
|
+
|
8
|
+
let(:test_desc1) { "be true" }
|
9
|
+
let(:test_block1) { Proc.new{ assert(true) } }
|
11
10
|
|
12
11
|
should "build a test using `test` with a desc and code block" do
|
13
|
-
d, b =
|
12
|
+
d, b = test_desc1, test_block1
|
14
13
|
context, test = build_eval_context{ test(d, &b) }
|
15
14
|
|
16
|
-
|
15
|
+
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
assert_that(test).is_kind_of(Assert::Test)
|
18
|
+
assert_that(test.name).equals(test_desc1)
|
19
|
+
assert_that(test.code).equals(test_block1)
|
21
20
|
end
|
22
21
|
|
23
22
|
should "build a test using `should` with a desc and code block" do
|
24
|
-
d, b =
|
23
|
+
d, b = test_desc1, test_block1
|
25
24
|
context, test = build_eval_context{ should(d, &b) }
|
26
25
|
|
27
|
-
|
26
|
+
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
assert_that(test).is_kind_of(Assert::Test)
|
29
|
+
assert_that(test.name).equals("should #{test_desc1}")
|
30
|
+
assert_that(test.code).equals(test_block1)
|
32
31
|
end
|
33
32
|
|
34
33
|
should "build a test that skips with no msg when `test_eventually` called" do
|
35
|
-
d, b =
|
34
|
+
d, b = test_desc1, test_block1
|
36
35
|
context, test = build_eval_context{ test_eventually(d, &b) }
|
37
36
|
err = capture_err(Assert::Result::TestSkipped) do
|
38
37
|
context.instance_eval(&test.code)
|
39
38
|
end
|
40
39
|
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
41
|
+
assert_that(err.message).equals("TODO")
|
42
|
+
assert_that(err.backtrace.size).equals(1)
|
44
43
|
end
|
45
44
|
|
46
45
|
should "build a test that skips with no msg when `should_eventually` called" do
|
47
|
-
d, b =
|
46
|
+
d, b = test_desc1, test_block1
|
48
47
|
context, test = build_eval_context{ should_eventually(d, &b) }
|
49
48
|
err = capture_err(Assert::Result::TestSkipped) do
|
50
49
|
context.instance_eval(&test.code)
|
51
50
|
end
|
52
51
|
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
53
|
+
assert_that(err.message).equals("TODO")
|
54
|
+
assert_that(err.backtrace.size).equals(1)
|
56
55
|
end
|
57
56
|
|
58
57
|
should "skip with the msg \"TODO\" when `test` called with no block" do
|
59
|
-
d =
|
58
|
+
d = test_desc1
|
60
59
|
context, test = build_eval_context { test(d) } # no block passed
|
61
60
|
err = capture_err(Assert::Result::TestSkipped) do
|
62
61
|
context.instance_eval(&test.code)
|
63
62
|
end
|
64
63
|
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
65
|
+
assert_that(err.message).equals("TODO")
|
66
|
+
assert_that(err.backtrace.size).equals(1)
|
68
67
|
end
|
69
68
|
|
70
69
|
should "skip with the msg \"TODO\" when `should` called with no block" do
|
71
|
-
d =
|
70
|
+
d = test_desc1
|
72
71
|
context, test = build_eval_context { should(d) } # no block passed
|
73
72
|
err = capture_err(Assert::Result::TestSkipped) do
|
74
73
|
context.instance_eval(&test.code)
|
75
74
|
end
|
76
75
|
|
77
|
-
|
78
|
-
|
79
|
-
|
76
|
+
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
77
|
+
assert_that(err.message).equals("TODO")
|
78
|
+
assert_that(err.backtrace.size).equals(1)
|
80
79
|
end
|
81
80
|
|
82
81
|
should "skip with the msg \"TODO\" when `test_eventually` called with no block" do
|
83
|
-
d =
|
82
|
+
d = test_desc1
|
84
83
|
context, test = build_eval_context{ test_eventually(d) } # no block given
|
85
84
|
err = capture_err(Assert::Result::TestSkipped) do
|
86
85
|
context.instance_eval(&test.code)
|
87
86
|
end
|
88
87
|
|
89
|
-
|
90
|
-
|
91
|
-
|
88
|
+
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
89
|
+
assert_that(err.message).equals("TODO")
|
90
|
+
assert_that(err.backtrace.size).equals(1)
|
92
91
|
end
|
93
92
|
|
94
93
|
should "skip with the msg \"TODO\" when `should_eventually` called with no block" do
|
95
|
-
d =
|
94
|
+
d = test_desc1
|
96
95
|
context, test = build_eval_context{ should_eventually(d) } # no block given
|
97
96
|
err = capture_err(Assert::Result::TestSkipped) do
|
98
97
|
context.instance_eval(&test.code)
|
99
98
|
end
|
100
99
|
|
101
|
-
|
102
|
-
|
103
|
-
|
100
|
+
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
101
|
+
assert_that(err.message).equals("TODO")
|
102
|
+
assert_that(err.backtrace.size).equals(1)
|
104
103
|
end
|
105
104
|
|
106
105
|
should "build a test from a macro using `test`" do
|
107
|
-
d, b =
|
106
|
+
d, b = test_desc1, test_block1
|
108
107
|
m = Assert::Macro.new{ test(d, &b); test(d, &b) }
|
109
108
|
context_class = Factory.modes_off_context_class{ test(m) }
|
110
109
|
|
111
|
-
|
110
|
+
assert_that(context_class.suite.tests_to_run_count).equals(2)
|
112
111
|
end
|
113
112
|
|
114
113
|
should "build a test from a macro using `should`" do
|
115
|
-
d, b =
|
114
|
+
d, b = test_desc1, test_block1
|
116
115
|
m = Assert::Macro.new{ should(d, &b); should(d, &b) }
|
117
116
|
context_class = Factory.modes_off_context_class{ should(m) }
|
118
117
|
|
119
|
-
|
118
|
+
assert_that(context_class.suite.tests_to_run_count).equals(2)
|
120
119
|
end
|
121
120
|
|
122
121
|
should "build a test that skips from a macro using `test_eventually`" do
|
123
|
-
d, b =
|
122
|
+
d, b = test_desc1, test_block1
|
124
123
|
m = Assert::Macro.new{ test(d, &b); test(d, &b) }
|
125
124
|
context, test = build_eval_context{ test_eventually(m) }
|
126
125
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
end
|
126
|
+
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
127
|
+
assert_that(-> { context.instance_eval(&test.code) }).
|
128
|
+
raises(Assert::Result::TestSkipped)
|
131
129
|
end
|
132
130
|
|
133
131
|
should "build a test that skips from a macro using `should_eventually`" do
|
134
|
-
d, b =
|
132
|
+
d, b = test_desc1, test_block1
|
135
133
|
m = Assert::Macro.new{ should(d, &b); should(d, &b) }
|
136
134
|
context, test = build_eval_context{ should_eventually(m) }
|
137
135
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
end
|
142
|
-
|
136
|
+
assert_that(context.class.suite.tests_to_run_count).equals(1)
|
137
|
+
assert_that(-> { context.instance_eval(&test.code) }).
|
138
|
+
raises(Assert::Result::TestSkipped)
|
143
139
|
end
|
144
140
|
|
145
141
|
private
|
146
142
|
|
147
143
|
def build_eval_context(&build_block)
|
148
|
-
context_class = Factory.modes_off_context_class
|
144
|
+
context_class = Factory.modes_off_context_class(&build_block)
|
149
145
|
test = context_class.suite.sorted_tests_to_run.to_a.last
|
150
146
|
[context_class.new(test, test.config, proc{ |r| }), test]
|
151
147
|
end
|