assert 2.18.2 → 2.19.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -2
  3. data/README.md +7 -6
  4. data/assert.gemspec +5 -2
  5. data/bin/assert +1 -0
  6. data/lib/assert.rb +2 -0
  7. data/lib/assert/actual_value.rb +143 -0
  8. data/lib/assert/assert_runner.rb +2 -0
  9. data/lib/assert/assertions.rb +82 -20
  10. data/lib/assert/cli.rb +2 -0
  11. data/lib/assert/config.rb +2 -0
  12. data/lib/assert/config_helpers.rb +2 -0
  13. data/lib/assert/context.rb +33 -37
  14. data/lib/assert/context/let_dsl.rb +16 -0
  15. data/lib/assert/context/method_missing.rb +22 -0
  16. data/lib/assert/context/setup_dsl.rb +3 -0
  17. data/lib/assert/context/subject_dsl.rb +26 -24
  18. data/lib/assert/context/suite_dsl.rb +3 -0
  19. data/lib/assert/context/test_dsl.rb +3 -0
  20. data/lib/assert/context_info.rb +2 -0
  21. data/lib/assert/default_runner.rb +2 -0
  22. data/lib/assert/default_suite.rb +2 -0
  23. data/lib/assert/default_view.rb +2 -0
  24. data/lib/assert/factory.rb +2 -0
  25. data/lib/assert/file_line.rb +2 -0
  26. data/lib/assert/macro.rb +2 -0
  27. data/lib/assert/macros/methods.rb +6 -4
  28. data/lib/assert/result.rb +8 -1
  29. data/lib/assert/runner.rb +2 -0
  30. data/lib/assert/stub.rb +45 -0
  31. data/lib/assert/suite.rb +9 -10
  32. data/lib/assert/test.rb +3 -9
  33. data/lib/assert/utils.rb +3 -1
  34. data/lib/assert/version.rb +3 -1
  35. data/lib/assert/view.rb +2 -0
  36. data/lib/assert/view_helpers.rb +2 -0
  37. data/test/helper.rb +28 -28
  38. data/test/support/factory.rb +17 -0
  39. data/test/support/inherited_stuff.rb +2 -0
  40. data/test/system/stub_tests.rb +334 -333
  41. data/test/system/test_tests.rb +101 -109
  42. data/test/unit/actual_value_tests.rb +373 -0
  43. data/test/unit/assert_tests.rb +79 -61
  44. data/test/unit/assertions/assert_block_tests.rb +32 -31
  45. data/test/unit/assertions/assert_changes_tests.rb +99 -0
  46. data/test/unit/assertions/assert_empty_tests.rb +35 -32
  47. data/test/unit/assertions/assert_equal_tests.rb +96 -74
  48. data/test/unit/assertions/assert_file_exists_tests.rb +34 -33
  49. data/test/unit/assertions/assert_includes_tests.rb +40 -37
  50. data/test/unit/assertions/assert_instance_of_tests.rb +36 -33
  51. data/test/unit/assertions/assert_kind_of_tests.rb +36 -33
  52. data/test/unit/assertions/assert_match_tests.rb +36 -33
  53. data/test/unit/assertions/assert_nil_tests.rb +32 -31
  54. data/test/unit/assertions/assert_raises_tests.rb +57 -55
  55. data/test/unit/assertions/assert_respond_to_tests.rb +38 -35
  56. data/test/unit/assertions/assert_same_tests.rb +88 -81
  57. data/test/unit/assertions/assert_true_false_tests.rb +62 -60
  58. data/test/unit/assertions_tests.rb +28 -24
  59. data/test/unit/config_helpers_tests.rb +45 -38
  60. data/test/unit/config_tests.rb +40 -34
  61. data/test/unit/context/let_dsl_tests.rb +12 -0
  62. data/test/unit/context/setup_dsl_tests.rb +72 -81
  63. data/test/unit/context/subject_dsl_tests.rb +17 -43
  64. data/test/unit/context/suite_dsl_tests.rb +17 -16
  65. data/test/unit/context/test_dsl_tests.rb +52 -52
  66. data/test/unit/context_info_tests.rb +25 -15
  67. data/test/unit/context_tests.rb +186 -179
  68. data/test/unit/default_runner_tests.rb +4 -5
  69. data/test/unit/default_suite_tests.rb +59 -53
  70. data/test/unit/factory_tests.rb +7 -3
  71. data/test/unit/file_line_tests.rb +35 -35
  72. data/test/unit/macro_tests.rb +16 -10
  73. data/test/unit/result_tests.rb +161 -183
  74. data/test/unit/runner_tests.rb +67 -65
  75. data/test/unit/suite_tests.rb +58 -59
  76. data/test/unit/test_tests.rb +120 -139
  77. data/test/unit/utils_tests.rb +45 -45
  78. data/test/unit/view_helpers_tests.rb +56 -52
  79. data/test/unit/view_tests.rb +24 -23
  80. metadata +29 -6
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "assert"
2
4
 
3
5
  require "assert/config"
@@ -7,19 +9,21 @@ require "much-stub"
7
9
  module Assert
8
10
  class UnitTests < Assert::Context
9
11
  desc "Assert"
10
- subject { Assert }
12
+ subject { unit_class }
13
+
14
+ let(:unit_class) { Assert }
11
15
 
12
16
  should have_imeths :config, :configure, :view, :suite, :runner
13
17
  should have_imeths :stubs, :stub, :unstub, :unstub!, :stub_send
14
18
 
15
19
  should "know its config instance" do
16
- assert_kind_of Assert::Config, subject.config
20
+ assert_that(subject.config).is_kind_of(Assert::Config)
17
21
  end
18
22
 
19
23
  should "map its view, suite and runner to its config" do
20
- assert_same subject.config.view, subject.view
21
- assert_same subject.config.suite, subject.suite
22
- assert_same subject.config.runner, subject.runner
24
+ assert_that(subject.view).is(subject.config.view)
25
+ assert_that(subject.suite).is(subject.config.suite)
26
+ assert_that(subject.runner).is(subject.config.runner)
23
27
  end
24
28
 
25
29
  # Note: don't really need to explicitly test the configure method as
@@ -27,102 +31,116 @@ module Assert
27
31
  end
28
32
 
29
33
  class StubTests < UnitTests
30
- setup do
31
- @orig_value = Factory.string
32
- @stub_value = Factory.string
33
-
34
- @myclass = Class.new do
34
+ let(:class1) {
35
+ Class.new do
35
36
  def initialize(value); @value = value; end
36
37
  def mymeth; @value; end
37
38
  end
38
- @myobj = @myclass.new(@orig_value)
39
- end
39
+ }
40
+ let(:object1) { class1.new(orig_value1) }
41
+ let(:orig_value1) { Factory.string }
42
+ let(:stub_value1) { Factory.string }
40
43
 
41
44
  should "build a stub" do
42
- stub1 = Assert.stub(@myobj, :mymeth)
45
+ stub1 = Assert.stub(object1, :mymeth)
46
+ assert_that(stub1).is_kind_of(MuchStub::Stub)
47
+ end
48
+
49
+ should "build a stub with an on_call block" do
50
+ my_meth_called_with = nil
51
+ stub1 =
52
+ Assert.stub_on_call(object1, :mymeth) { |call|
53
+ my_meth_called_with = call
54
+ }
55
+
56
+ object1.mymeth
43
57
  assert_kind_of MuchStub::Stub, stub1
58
+ assert_equal [], my_meth_called_with.args
44
59
  end
45
60
 
46
61
  should "lookup stubs that have been called before" do
47
- stub1 = Assert.stub(@myobj, :mymeth)
48
- stub2 = Assert.stub(@myobj, :mymeth)
49
- assert_same stub1, stub2
62
+ stub1 = Assert.stub(object1, :mymeth)
63
+ stub2 = Assert.stub(object1, :mymeth)
64
+ assert_that(stub2).is(stub1)
50
65
  end
51
66
 
52
67
  should "set the stub's do block if given a block" do
53
- Assert.stub(@myobj, :mymeth)
54
- assert_raises(MuchStub::NotStubbedError){ @myobj.mymeth }
55
- Assert.stub(@myobj, :mymeth){ @stub_value }
56
- assert_equal @stub_value, @myobj.mymeth
68
+ Assert.stub(object1, :mymeth)
69
+ assert_that { object1.mymeth }.raises(MuchStub::NotStubbedError)
70
+ Assert.stub(object1, :mymeth){ stub_value1 }
71
+ assert_that(object1.mymeth).equals(stub_value1)
57
72
  end
58
73
 
59
74
  should "teardown stubs" do
60
- assert_equal @orig_value, @myobj.mymeth
61
- Assert.unstub(@myobj, :mymeth)
62
- assert_equal @orig_value, @myobj.mymeth
63
-
64
- assert_equal @orig_value, @myobj.mymeth
65
- Assert.stub(@myobj, :mymeth){ @stub_value }
66
- assert_equal @stub_value, @myobj.mymeth
67
- Assert.unstub(@myobj, :mymeth)
68
- assert_equal @orig_value, @myobj.mymeth
75
+ assert_that(object1.mymeth).equals(orig_value1)
76
+ Assert.unstub(object1, :mymeth)
77
+ assert_that(object1.mymeth).equals(orig_value1)
78
+
79
+ assert_that(object1.mymeth).equals(orig_value1)
80
+ Assert.stub(object1, :mymeth){ stub_value1 }
81
+ assert_that(object1.mymeth).equals(stub_value1)
82
+ Assert.unstub(object1, :mymeth)
83
+ assert_that(object1.mymeth).equals(orig_value1)
69
84
  end
70
85
 
71
86
  should "know and teardown all stubs" do
72
- assert_equal @orig_value, @myobj.mymeth
87
+ assert_that(object1.mymeth).equals(orig_value1)
73
88
 
74
- Assert.stub(@myobj, :mymeth){ @stub_value }
75
- assert_equal @stub_value, @myobj.mymeth
76
- assert_equal 1, Assert.stubs.size
89
+ Assert.stub(object1, :mymeth){ stub_value1 }
90
+ assert_that(object1.mymeth).equals(stub_value1)
91
+ assert_that(Assert.stubs.size).equals(1)
77
92
 
78
93
  Assert.unstub!
79
- assert_equal @orig_value, @myobj.mymeth
80
- assert_empty Assert.stubs
94
+ assert_that(object1.mymeth).equals(orig_value1)
95
+ assert_that(Assert.stubs).is_empty
81
96
  end
82
97
 
83
98
  should "auto-unstub any stubs on teardown" do
84
99
  context_class = ::Factory.modes_off_context_class do
85
100
  setup do
86
- Assert.stub("1", :to_s){ "one" }
101
+ Assert.stub(+"1", :to_s){ "one" }
87
102
  end
88
103
  end
89
104
 
90
105
  context_class.run_setups("scope")
91
- assert_equal 1, Assert.stubs.size
106
+ assert_that(Assert.stubs.size).equals(1)
92
107
 
93
108
  context_class.run_teardowns("scope")
94
- assert_empty Assert.stubs
109
+ assert_that(Assert.stubs).is_empty
95
110
  end
96
111
 
97
112
  should "be able to call a stub's original method" do
98
- err = assert_raises(MuchStub::NotStubbedError){ Assert.stub_send(@myobj, :mymeth) }
99
- assert_includes "not stubbed.", err.message
100
- assert_includes "test/unit/assert_tests.rb", err.backtrace.first
113
+ err =
114
+ assert_that {
115
+ Assert.stub_send(object1, :mymeth)
116
+ }.raises(MuchStub::NotStubbedError)
117
+ assert_that(err.message).includes("not stubbed.")
118
+ assert_that(err.backtrace.first).includes("test/unit/assert_tests.rb")
101
119
 
102
- Assert.stub(@myobj, :mymeth){ @stub_value }
120
+ Assert.stub(object1, :mymeth){ stub_value1 }
103
121
 
104
- assert_equal @stub_value, @myobj.mymeth
105
- assert_equal @orig_value, Assert.stub_send(@myobj, :mymeth)
122
+ assert_that(object1.mymeth).equals(stub_value1)
123
+ assert_that(Assert.stub_send(object1, :mymeth)).equals(orig_value1)
106
124
  end
107
125
 
108
126
  should "be able to add a stub tap" do
109
127
  my_meth_called_with = nil
110
- Assert.stub_tap(@myobj, :mymeth){ |value, *args, &block|
128
+ Assert.stub_tap(object1, :mymeth){ |value, *args, &block|
111
129
  my_meth_called_with = args
112
130
  }
113
131
 
114
- assert_equal @orig_value, @myobj.mymeth
115
- assert_equal [], my_meth_called_with
132
+ assert_that(object1.mymeth).equals(orig_value1)
133
+ assert_that(my_meth_called_with).equals([])
116
134
  end
117
135
 
118
136
  should "be able to add a stub tap with an on_call block" do
119
137
  my_meth_called_with = nil
120
- Assert.stub_tap_on_call(@myobj, :mymeth){ |value, call|
138
+ Assert.stub_tap_on_call(object1, :mymeth){ |value, call|
121
139
  my_meth_called_with = call
122
140
  }
123
141
 
124
- assert_equal @orig_value, @myobj.mymeth
125
- assert_equal [], my_meth_called_with.args
142
+ assert_that(object1.mymeth).equals(orig_value1)
143
+ assert_that(my_meth_called_with.args).equals([])
126
144
  end
127
145
 
128
146
  should "be able to add a stubbed spy" do
@@ -142,19 +160,19 @@ module Assert
142
160
  :three,
143
161
  ready?: true)
144
162
 
145
- assert_equal spy, myobj.one
146
- assert_equal spy, myobj.two("a")
147
- assert_equal spy, myobj.three
163
+ assert_that(myobj.one).equals(spy)
164
+ assert_that(myobj.two("a")).equals(spy)
165
+ assert_that(myobj.three).equals(spy)
148
166
 
149
- assert_true myobj.one.two("b").three.ready?
167
+ assert_that(myobj.one.two("b").three.ready?).is_true
150
168
 
151
- assert_kind_of MuchStub::CallSpy, spy
152
- assert_equal 2, spy.one_call_count
153
- assert_equal 2, spy.two_call_count
154
- assert_equal 2, spy.three_call_count
155
- assert_equal 1, spy.ready_predicate_call_count
156
- assert_equal ["b"], spy.two_last_called_with.args
157
- assert_true spy.ready_predicate_called?
169
+ assert_that(spy).is_kind_of(MuchStub::CallSpy)
170
+ assert_that(spy.one_call_count).equals(2)
171
+ assert_that(spy.two_call_count).equals(2)
172
+ assert_that(spy.three_call_count).equals(2)
173
+ assert_that(spy.ready_predicate_call_count).equals(1)
174
+ assert_that(spy.two_last_called_with.args).equals(["b"])
175
+ assert_that(spy.ready_predicate_called?).is_true
158
176
  end
159
177
  end
160
178
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "assert"
2
4
  require "assert/assertions"
3
5
 
@@ -6,25 +8,25 @@ module Assert::Assertions
6
8
  include Assert::Test::TestHelpers
7
9
 
8
10
  desc "`assert_block`"
9
- setup do
10
- desc = @desc = "assert block fail desc"
11
- @test = Factory.test do
12
- assert_block{ true } # pass
13
- assert_block(desc){ false } # fail
11
+ subject {
12
+ desc = desc1
13
+ Factory.test do
14
+ assert_block { true } # pass
15
+ assert_block(desc) { false } # fail
14
16
  end
15
- @test.run(&test_run_callback)
16
- end
17
- subject{ @test }
17
+ }
18
+
19
+ let(:desc1) { "assert block fail desc" }
18
20
 
19
21
  should "produce results as expected" do
20
- assert_equal 2, test_run_result_count
21
- assert_equal 1, test_run_result_count(:pass)
22
- assert_equal 1, test_run_result_count(:fail)
23
- end
22
+ subject.run(&test_run_callback)
23
+
24
+ assert_that(test_run_result_count).equals(2)
25
+ assert_that(test_run_result_count(:pass)).equals(1)
26
+ assert_that(test_run_result_count(:fail)).equals(1)
24
27
 
25
- should "have a fail message with custom and generic explanations" do
26
- exp = "#{@desc}\nExpected block to return a true value."
27
- assert_equal exp, test_run_results(:fail).first.message
28
+ exp = "#{desc1}\nExpected block to return a true value."
29
+ assert_that(test_run_results(:fail).first.message).equals(exp)
28
30
  end
29
31
  end
30
32
 
@@ -32,26 +34,25 @@ module Assert::Assertions
32
34
  include Assert::Test::TestHelpers
33
35
 
34
36
  desc "`assert_not_block`"
35
- setup do
36
- desc = @desc = "assert not block fail desc"
37
- @test = Factory.test do
38
- assert_not_block(desc){ true } # fail
39
- assert_not_block{ false } # pass
37
+ subject {
38
+ desc = desc1
39
+ Factory.test do
40
+ assert_not_block(desc) { true } # fail
41
+ assert_not_block { false } # pass
40
42
  end
41
- @test.run(&test_run_callback)
42
- end
43
- subject{ @test }
43
+ }
44
+
45
+ let(:desc1) { "assert not block fail desc" }
44
46
 
45
47
  should "produce results as expected" do
46
- assert_equal 2, test_run_result_count
47
- assert_equal 1, test_run_result_count(:pass)
48
- assert_equal 1, test_run_result_count(:fail)
49
- end
48
+ subject.run(&test_run_callback)
50
49
 
51
- should "have a fail message with custom and generic explanations" do
52
- exp = "#{@desc}\nExpected block to not return a true value."
53
- assert_equal exp, test_run_results(:fail).first.message
50
+ assert_that(test_run_result_count).equals(2)
51
+ assert_that(test_run_result_count(:pass)).equals(1)
52
+ assert_that(test_run_result_count(:fail)).equals(1)
53
+
54
+ exp = "#{desc1}\nExpected block to not return a true value."
55
+ assert_that(test_run_results(:fail).first.message).equals(exp)
54
56
  end
55
57
  end
56
58
  end
57
-
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "assert"
4
+ require "assert/assertions"
5
+
6
+ module Assert::Assertions
7
+ class AssertChangesTests < Assert::Context
8
+ include Assert::Test::TestHelpers
9
+
10
+ desc "`assert_changes`"
11
+ subject {
12
+ desc = desc1
13
+ Factory.test do
14
+ @my_var = 1
15
+ assert_changes("@my_var", from: 1, to: 2) { @my_var = 2 } # pass
16
+ @my_var = 1
17
+ assert_changes("@my_var", from: 1) { @my_var = 2 } # pass
18
+ @my_var = 1
19
+ assert_changes("@my_var", to: 2) { @my_var = 2 } # pass
20
+ @my_var = 1
21
+ assert_changes("@my_var", desc: desc) { @my_var = 2 } # pass
22
+
23
+ @my_var = 1
24
+ assert_changes("@my_var", from: 2, to: 1) { @my_var = 2 } # fail
25
+ @my_var = 1
26
+ assert_changes("@my_var", from: 2) { @my_var = 2 } # fail
27
+ @my_var = 1
28
+ assert_changes("@my_var", to: 1) { @my_var = 2 } # fail
29
+ @my_var = 1
30
+ assert_changes("@my_var", desc: desc) { @my_var = 1 } # fail
31
+ end
32
+ }
33
+
34
+ let(:desc1) { "assert changes fail desc" }
35
+
36
+ should "produce results as expected" do
37
+ subject.run(&test_run_callback)
38
+
39
+ assert_that(test_run_result_count).equals(10)
40
+ assert_that(test_run_result_count(:pass)).equals(5)
41
+ assert_that(test_run_result_count(:fail)).equals(5)
42
+
43
+ exp =
44
+ [
45
+ "Expected `@my_var` to change from `2`",
46
+ "Expected `@my_var` to change to `1`",
47
+ "Expected `@my_var` to change from `2`",
48
+ "Expected `@my_var` to change to `1`",
49
+ "#{desc1}\nExpected `@my_var` to change; "\
50
+ "it was `1` and didn't change",
51
+ ]
52
+ messages = test_run_results(:fail).map(&:message)
53
+ messages.each_with_index{ |msg, n| assert_that(msg).matches(/^#{exp[n]}/) }
54
+ end
55
+ end
56
+
57
+ class AssertNotChangesTests < Assert::Context
58
+ include Assert::Test::TestHelpers
59
+
60
+ desc "`assert_changes`"
61
+ subject {
62
+ desc = desc1
63
+ Factory.test do
64
+ @my_var = 1
65
+ assert_not_changes("@my_var", from: 1) { @my_var = 1 } # pass
66
+ @my_var = 1
67
+ assert_not_changes("@my_var", desc: desc) { @my_var = 1 } # pass
68
+
69
+ @my_var = 1
70
+ assert_not_changes("@my_var", from: 2) { @my_var = 1 } # fail
71
+ @my_var = 1
72
+ assert_not_changes("@my_var", from: 1) { @my_var = 2 } # fail
73
+ @my_var = 1
74
+ assert_not_changes("@my_var", desc: desc) { @my_var = 2 } # fail
75
+ end
76
+ }
77
+
78
+ let(:desc1) { "assert not changes fail desc" }
79
+
80
+ should "produce results as expected" do
81
+ subject.run(&test_run_callback)
82
+
83
+ assert_that(test_run_result_count).equals(8)
84
+ assert_that(test_run_result_count(:pass)).equals(5)
85
+ assert_that(test_run_result_count(:fail)).equals(3)
86
+
87
+ exp =
88
+ [
89
+ "Expected `@my_var` to not change from `2`",
90
+ "Expected `@my_var` to not change; "\
91
+ "it was `1` and changed to `2`",
92
+ "#{desc1}\nExpected `@my_var` to not change; "\
93
+ "it was `1` and changed to `2`",
94
+ ]
95
+ messages = test_run_results(:fail).map(&:message)
96
+ messages.each_with_index{ |msg, n| assert_that(msg).matches(/^#{exp[n]}/) }
97
+ end
98
+ end
99
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "assert"
2
4
  require "assert/assertions"
3
5
 
@@ -8,56 +10,57 @@ module Assert::Assertions
8
10
  include Assert::Test::TestHelpers
9
11
 
10
12
  desc "`assert_empty`"
11
- setup do
12
- desc = @desc = "assert empty fail desc"
13
- args = @args = [[1], desc]
14
- @test = Factory.test do
13
+ subject {
14
+ args = args1
15
+ Factory.test do
15
16
  assert_empty([]) # pass
16
17
  assert_empty(*args) # fail
17
18
  end
18
- @c = @test.config
19
- @test.run(&test_run_callback)
20
- end
21
- subject{ @test }
19
+ }
20
+
21
+ let(:desc1) { "assert empty fail desc" }
22
+ let(:args1) { [[1], desc1] }
23
+ let(:config1) { subject.config }
22
24
 
23
25
  should "produce results as expected" do
24
- assert_equal 2, test_run_result_count
25
- assert_equal 1, test_run_result_count(:pass)
26
- assert_equal 1, test_run_result_count(:fail)
27
- end
26
+ subject.run(&test_run_callback)
28
27
 
29
- should "have a fail message with custom and generic explanations" do
30
- exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0], @c)} to be empty."
31
- assert_equal exp, test_run_results(:fail).first.message
32
- end
28
+ assert_that(test_run_result_count).equals(2)
29
+ assert_that(test_run_result_count(:pass)).equals(1)
30
+ assert_that(test_run_result_count(:fail)).equals(1)
33
31
 
32
+ exp =
33
+ "#{args1[1]}\nExpected #{Assert::U.show(args1[0], config1)} to be empty."
34
+ assert_that(test_run_results(:fail).first.message).equals(exp)
35
+ end
34
36
  end
35
37
 
36
38
  class AssertNotEmptyTests < Assert::Context
37
39
  include Assert::Test::TestHelpers
38
40
 
39
41
  desc "`assert_not_empty`"
40
- setup do
41
- desc = @desc = "assert not empty fail desc"
42
- args = @args = [[], desc]
43
- @test = Factory.test do
44
- assert_not_empty([1]) # pass
42
+ subject {
43
+ args = args1
44
+ Factory.test do
45
+ assert_not_empty([1]) # pass
45
46
  assert_not_empty(*args) # fail
46
47
  end
47
- @c = @test.config
48
- @test.run(&test_run_callback)
49
- end
50
- subject{ @test }
48
+ }
49
+
50
+ let(:desc1) { "assert not empty fail desc" }
51
+ let(:args1) { [[], desc1] }
52
+ let(:config1) { subject.config }
51
53
 
52
54
  should "produce results as expected" do
53
- assert_equal 2, test_run_result_count
54
- assert_equal 1, test_run_result_count(:pass)
55
- assert_equal 1, test_run_result_count(:fail)
56
- end
55
+ subject.run(&test_run_callback)
56
+
57
+ assert_that(test_run_result_count).equals(2)
58
+ assert_that(test_run_result_count(:pass)).equals(1)
59
+ assert_that(test_run_result_count(:fail)).equals(1)
57
60
 
58
- should "have a fail message with custom and generic explanations" do
59
- exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0], @c)} to not be empty."
60
- assert_equal exp, test_run_results(:fail).first.message
61
+ exp =
62
+ "#{args1[1]}\nExpected #{Assert::U.show(args1[0], config1)} to not be empty."
63
+ assert_that(test_run_results(:fail).first.message).equals(exp)
61
64
  end
62
65
  end
63
66
  end