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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -6
  3. data/assert.gemspec +1 -1
  4. data/lib/assert/actual_value.rb +127 -0
  5. data/lib/assert/assertions.rb +11 -20
  6. data/lib/assert/context.rb +13 -5
  7. data/lib/assert/context/let_dsl.rb +13 -0
  8. data/lib/assert/context/method_missing.rb +19 -0
  9. data/lib/assert/macros/methods.rb +4 -4
  10. data/lib/assert/stub.rb +4 -0
  11. data/lib/assert/version.rb +1 -1
  12. data/test/helper.rb +23 -25
  13. data/test/support/factory.rb +15 -0
  14. data/test/system/stub_tests.rb +348 -333
  15. data/test/system/test_tests.rb +111 -109
  16. data/test/unit/actual_value_tests.rb +335 -0
  17. data/test/unit/assert_tests.rb +84 -59
  18. data/test/unit/assertions/assert_block_tests.rb +32 -31
  19. data/test/unit/assertions/assert_empty_tests.rb +35 -32
  20. data/test/unit/assertions/assert_equal_tests.rb +81 -75
  21. data/test/unit/assertions/assert_file_exists_tests.rb +34 -33
  22. data/test/unit/assertions/assert_includes_tests.rb +40 -37
  23. data/test/unit/assertions/assert_instance_of_tests.rb +36 -33
  24. data/test/unit/assertions/assert_kind_of_tests.rb +36 -33
  25. data/test/unit/assertions/assert_match_tests.rb +36 -33
  26. data/test/unit/assertions/assert_nil_tests.rb +32 -31
  27. data/test/unit/assertions/assert_raises_tests.rb +55 -55
  28. data/test/unit/assertions/assert_respond_to_tests.rb +38 -35
  29. data/test/unit/assertions/assert_same_tests.rb +91 -80
  30. data/test/unit/assertions/assert_true_false_tests.rb +64 -60
  31. data/test/unit/assertions_tests.rb +15 -13
  32. data/test/unit/config_helpers_tests.rb +36 -35
  33. data/test/unit/config_tests.rb +33 -34
  34. data/test/unit/context/let_dsl_tests.rb +10 -0
  35. data/test/unit/context/setup_dsl_tests.rb +70 -81
  36. data/test/unit/context/subject_dsl_tests.rb +16 -43
  37. data/test/unit/context/suite_dsl_tests.rb +16 -16
  38. data/test/unit/context/test_dsl_tests.rb +50 -54
  39. data/test/unit/context_info_tests.rb +16 -15
  40. data/test/unit/context_tests.rb +170 -157
  41. data/test/unit/default_runner_tests.rb +2 -5
  42. data/test/unit/default_suite_tests.rb +51 -53
  43. data/test/unit/factory_tests.rb +3 -3
  44. data/test/unit/file_line_tests.rb +31 -33
  45. data/test/unit/macro_tests.rb +9 -10
  46. data/test/unit/result_tests.rb +150 -163
  47. data/test/unit/runner_tests.rb +63 -63
  48. data/test/unit/suite_tests.rb +57 -54
  49. data/test/unit/test_tests.rb +134 -126
  50. data/test/unit/utils_tests.rb +41 -45
  51. data/test/unit/view_helpers_tests.rb +55 -52
  52. data/test/unit/view_tests.rb +20 -22
  53. metadata +11 -4
@@ -0,0 +1,10 @@
1
+ require "assert"
2
+ require "assert/context/let_dsl"
3
+
4
+ module Assert::Context::LetDSL
5
+ class UnitTests < Assert::Context
6
+ desc "Assert::Context::LetDSL"
7
+
8
+ # This is tested implicitly by running Assert's test suite.
9
+ end
10
+ end
@@ -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{ @context_class }
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
- assert_includes @block, subject.suite.send(:setups)
22
- assert_includes @block, subject.suite.send(:teardowns)
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
- assert_includes @block, subject.send(:setups)
38
- assert_includes @block, subject.send(:teardowns)
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
- setup do
45
- method_name = @method_name = :something_amazing
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
- assert_includes @method_name, subject.send(:setups)
54
- assert_includes @method_name, subject.send(:teardowns)
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 SetupTeardownMultipleTests < UnitTests
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
- context_setup_block = ::Proc.new{ self.setup_status += " has been run" }
69
- context_teardown_block = ::Proc.new{ self.teardown_status += "has been run " }
70
- @context_class = Factory.modes_off_context_class(@parent_class) do
71
- setup(&context_setup_block)
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
- @test_status_class = Class.new do
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
- end
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
- should "run it's parent and it's own blocks in the correct order" do
89
- subject.send("run_setups", obj = @test_status_class.new)
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 = @test_status_class.new)
93
- assert_equal "with something has been run the teardown", obj.teardown_status
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 < UnitTests
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
- @context_class = Factory.modes_off_context_class(@parent_class) do
110
- around do |block|
111
- self.out_status += "c-around1 start, "
112
- block.call
113
- self.out_status += "c-around1 end, "
114
- end
115
- around do |block|
116
- self.out_status += "c-around2 start, "
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
- @test_status_class = Class.new do
123
- attr_accessor :out_status
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
- should "run it's parent and it's own blocks in the correct order" do
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 = "p-around start, c-around1 start, c-around2 start, "\
134
- "TEST, "\
135
- "c-around2 end, c-around1 end, p-around end."
136
- assert_equal exp, obj.out_status
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{ @context_class }
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
- should "return a collection containing any descriptions defined on the class" do
21
- assert_equal @descs, subject.send(:descriptions)
22
- end
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
- exp_desc = "parent description and the description for this context"
40
- assert_equal exp_desc, @context_class.description
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
- assert_equal @subject_block, @context_class.subject
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 it's parents subject block" do
69
- assert_equal @parent_block, @context_class.subject
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
- setup do
10
- @custom_suite = Factory.modes_off_suite
11
- @context_class = Factory.context_class
12
- end
13
- subject{ @context_class }
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
- assert_equal Assert.suite, subject.suite
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(@custom_suite)
21
- assert_equal @custom_suite, subject.suite
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
- @parent_class = Factory.context_class
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
- should "default to it's parent's suite" do
34
- assert_equal @custom_suite, subject.suite
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
- another_suite = Factory.modes_off_suite
39
- subject.suite(another_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
- setup do
8
- @test_desc = "be true"
9
- @test_block = ::Proc.new{ assert(true) }
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 = @test_desc, @test_block
12
+ d, b = test_desc1, test_block1
14
13
  context, test = build_eval_context{ test(d, &b) }
15
14
 
16
- assert_equal 1, context.class.suite.tests_to_run_count
15
+ assert_that(context.class.suite.tests_to_run_count).equals(1)
17
16
 
18
- assert_kind_of Assert::Test, test
19
- assert_equal @test_desc, test.name
20
- assert_equal @test_block, test.code
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 = @test_desc, @test_block
23
+ d, b = test_desc1, test_block1
25
24
  context, test = build_eval_context{ should(d, &b) }
26
25
 
27
- assert_equal 1, context.class.suite.tests_to_run_count
26
+ assert_that(context.class.suite.tests_to_run_count).equals(1)
28
27
 
29
- assert_kind_of Assert::Test, test
30
- assert_equal "should #{@test_desc}", test.name
31
- assert_equal @test_block, test.code
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 = @test_desc, @test_block
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
- assert_equal 1, context.class.suite.tests_to_run_count
42
- assert_equal "TODO", err.message
43
- assert_equal 1, err.backtrace.size
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 = @test_desc, @test_block
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
- assert_equal 1, context.class.suite.tests_to_run_count
54
- assert_equal "TODO", err.message
55
- assert_equal 1, err.backtrace.size
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 = @test_desc
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
- assert_equal 1, context.class.suite.tests_to_run_count
66
- assert_equal "TODO", err.message
67
- assert_equal 1, err.backtrace.size
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 = @test_desc
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
- assert_equal 1, context.class.suite.tests_to_run_count
78
- assert_equal "TODO", err.message
79
- assert_equal 1, err.backtrace.size
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 = @test_desc
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
- assert_equal 1, context.class.suite.tests_to_run_count
90
- assert_equal "TODO", err.message
91
- assert_equal 1, err.backtrace.size
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 = @test_desc
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
- assert_equal 1, context.class.suite.tests_to_run_count
102
- assert_equal "TODO", err.message
103
- assert_equal 1, err.backtrace.size
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 = @test_desc, @test_block
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
- assert_equal 2, context_class.suite.tests_to_run_count
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 = @test_desc, @test_block
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
- assert_equal 2, context_class.suite.tests_to_run_count
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 = @test_desc, @test_block
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
- assert_equal 1, context.class.suite.tests_to_run_count
128
- assert_raises(Assert::Result::TestSkipped) do
129
- context.instance_eval(&test.code)
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 = @test_desc, @test_block
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
- assert_equal 1, context.class.suite.tests_to_run_count
139
- assert_raises(Assert::Result::TestSkipped) do
140
- context.instance_eval(&test.code)
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 &build_block
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