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
  require "assert/assertions"
3
5
 
@@ -8,32 +10,35 @@ module Assert::Assertions
8
10
  include Assert::Test::TestHelpers
9
11
 
10
12
  desc "`assert_same`"
11
- setup do
12
- klass = Class.new; object = klass.new
13
- desc = @desc = "assert same fail desc"
14
- args = @args = [object, klass.new, desc]
15
- @test = Factory.test do
13
+ subject {
14
+ args = args1
15
+ object = object1
16
+ Factory.test do
16
17
  assert_same(object, object) # pass
17
18
  assert_same(*args) # fail
18
19
  end
19
- @c = @test.config
20
- @test.run(&test_run_callback)
21
- end
22
- subject{ @test }
20
+ }
23
21
 
24
- should "produce results as expected" do
25
- assert_equal 2, test_run_result_count
26
- assert_equal 1, test_run_result_count(:pass)
27
- assert_equal 1, test_run_result_count(:fail)
28
- end
22
+ let(:class1) { Class.new }
23
+ let(:object1) { class1.new }
24
+ let(:desc1) { "assert same fail desc" }
25
+ let(:args1) { [object1, class1.new, desc1] }
26
+ let(:config1) { subject.config }
29
27
 
30
- should "have a fail message with custom and generic explanations" do
31
- exp = "#{@args[2]}\n"\
32
- "Expected #{Assert::U.show(@args[1], @c)}"\
33
- " (#<#{@args[1].class}:#{"0x0%x" % (@args[1].object_id << 1)}>)"\
34
- " to be the same as #{Assert::U.show(@args[0], @c)}"\
35
- " (#<#{@args[0].class}:#{"0x0%x" % (@args[0].object_id << 1)}>)."
36
- assert_equal exp, test_run_results(:fail).first.message
28
+ should "produce results as expected" do
29
+ subject.run(&test_run_callback)
30
+
31
+ assert_that(test_run_result_count).equals(2)
32
+ assert_that(test_run_result_count(:pass)).equals(1)
33
+ assert_that(test_run_result_count(:fail)).equals(1)
34
+
35
+ exp =
36
+ "#{args1[2]}\n"\
37
+ "Expected #{Assert::U.show(args1[1], config1)}"\
38
+ " (#<#{args1[1].class}:#{"0x0%x" % (args1[1].object_id << 1)}>)"\
39
+ " to be the same as #{Assert::U.show(args1[0], config1)}"\
40
+ " (#<#{args1[0].class}:#{"0x0%x" % (args1[0].object_id << 1)}>)."
41
+ assert_that(test_run_results(:fail).first.message).equals(exp)
37
42
  end
38
43
  end
39
44
 
@@ -41,32 +46,36 @@ module Assert::Assertions
41
46
  include Assert::Test::TestHelpers
42
47
 
43
48
  desc "`assert_not_same`"
44
- setup do
45
- klass = Class.new; object = klass.new
46
- desc = @desc = "assert not same fail desc"
47
- args = @args = [object, object, desc]
48
- @test = Factory.test do
49
+ subject {
50
+ args = args1
51
+ object = object1
52
+ klass = class1
53
+ Factory.test do
49
54
  assert_not_same(*args) # fail
50
55
  assert_not_same(object, klass.new) # pass
51
56
  end
52
- @c = @test.config
53
- @test.run(&test_run_callback)
54
- end
55
- subject{ @test }
57
+ }
56
58
 
57
- should "produce results as expected" do
58
- assert_equal 2, test_run_result_count
59
- assert_equal 1, test_run_result_count(:pass)
60
- assert_equal 1, test_run_result_count(:fail)
61
- end
59
+ let(:class1) { Class.new }
60
+ let(:object1) { class1.new }
61
+ let(:desc1) { "assert not same fail desc" }
62
+ let(:args1) { [object1, object1, desc1] }
63
+ let(:config1) { subject.config }
62
64
 
63
- should "have a fail message with custom and generic explanations" do
64
- exp = "#{@args[2]}\n"\
65
- "Expected #{Assert::U.show(@args[1], @c)}"\
66
- " (#<#{@args[1].class}:#{"0x0%x" % (@args[1].object_id << 1)}>)"\
67
- " to not be the same as #{Assert::U.show(@args[0], @c)}"\
68
- " (#<#{@args[0].class}:#{"0x0%x" % (@args[0].object_id << 1)}>)."
69
- assert_equal exp, test_run_results(:fail).first.message
65
+ should "produce results as expected" do
66
+ subject.run(&test_run_callback)
67
+
68
+ assert_that(test_run_result_count).equals(2)
69
+ assert_that(test_run_result_count(:pass)).equals(1)
70
+ assert_that(test_run_result_count(:fail)).equals(1)
71
+
72
+ exp =
73
+ "#{args1[2]}\n"\
74
+ "Expected #{Assert::U.show(args1[1], config1)}"\
75
+ " (#<#{args1[1].class}:#{"0x0%x" % (args1[1].object_id << 1)}>)"\
76
+ " to not be the same as #{Assert::U.show(args1[0], config1)}"\
77
+ " (#<#{args1[0].class}:#{"0x0%x" % (args1[0].object_id << 1)}>)."
78
+ assert_that(test_run_results(:fail).first.message).equals(exp)
70
79
  end
71
80
  end
72
81
 
@@ -74,62 +83,60 @@ module Assert::Assertions
74
83
  include Assert::Test::TestHelpers
75
84
 
76
85
  desc "with objects that should use diff when showing"
77
- setup do
78
- @exp_obj = "I'm a\nstring"
79
- @act_obj = "I am a \nstring"
80
-
81
- @c = Factory.modes_off_config
82
- @c.use_diff_proc(Assert::U.default_use_diff_proc)
83
- @c.run_diff_proc(Assert::U.syscmd_diff_proc)
86
+ let(:config1) {
87
+ Factory.modes_off_config.tap do |config|
88
+ config.use_diff_proc(Assert::U.default_use_diff_proc)
89
+ config.run_diff_proc(Assert::U.syscmd_diff_proc)
90
+ end
91
+ }
84
92
 
85
- @exp_obj_show = Assert::U.show_for_diff(@exp_obj, @c)
86
- @act_obj_show = Assert::U.show_for_diff(@act_obj, @c)
87
- end
93
+ let(:exp_obj1) { "I'm a\nstring" }
94
+ let(:act_obj1) { "I am a \nstring" }
95
+ let(:exp_obj_show1) { Assert::U.show_for_diff(exp_obj1, config1) }
96
+ let(:act_obj_show1) { Assert::U.show_for_diff(act_obj1, config1) }
88
97
  end
89
98
 
90
99
  class AssertSameDiffTests < DiffTests
91
100
  desc "`assert_same`"
92
- setup do
93
- exp_obj, act_obj = @exp_obj, @act_obj
94
- @test = Factory.test(@c) do
101
+ subject {
102
+ exp_obj, act_obj = exp_obj1, act_obj1
103
+ Factory.test(config1) do
95
104
  assert_same(exp_obj, act_obj)
96
105
  end
97
- @test.run(&test_run_callback)
98
- end
99
- subject{ @test }
106
+ }
100
107
 
101
108
  should "include diff output in the fail messages" do
102
- exp = "Expected #<#{@act_obj.class}:#{"0x0%x" % (@act_obj.object_id << 1)}>"\
103
- " to be the same as"\
104
- " #<#{@exp_obj.class}:#{"0x0%x" % (@exp_obj.object_id << 1)}>"\
105
- ", diff:\n"\
106
- "#{Assert::U.syscmd_diff_proc.call(@exp_obj_show, @act_obj_show)}"
107
- assert_equal exp, test_run_results(:fail).first.message
109
+ subject.run(&test_run_callback)
110
+
111
+ exp =
112
+ "Expected #<#{act_obj1.class}:#{"0x0%x" % (act_obj1.object_id << 1)}>"\
113
+ " to be the same as"\
114
+ " #<#{exp_obj1.class}:#{"0x0%x" % (exp_obj1.object_id << 1)}>"\
115
+ ", diff:\n"\
116
+ "#{Assert::U.syscmd_diff_proc.call(exp_obj_show1, act_obj_show1)}"
117
+ assert_that(test_run_results(:fail).first.message).equals(exp)
108
118
  end
109
119
  end
110
120
 
111
121
  class AssertNotSameDiffTests < DiffTests
112
122
  desc "`assert_not_same`"
113
- setup do
114
- @exp_obj = @act_obj
115
- @exp_obj_show = @act_obj_show
116
-
117
- exp_obj, act_obj = @exp_obj, @act_obj
118
- @test = Factory.test(@c) do
119
- assert_not_same(exp_obj, exp_obj)
123
+ subject {
124
+ act_obj = act_obj1
125
+ Factory.test(config1) do
126
+ assert_not_same(act_obj, act_obj)
120
127
  end
121
- @test.run(&test_run_callback)
122
- end
123
- subject{ @test }
128
+ }
124
129
 
125
130
  should "include diff output in the fail messages" do
126
- exp = "Expected #<#{@act_obj.class}:#{"0x0%x" % (@act_obj.object_id << 1)}>"\
127
- " to not be the same as"\
128
- " #<#{@exp_obj.class}:#{"0x0%x" % (@exp_obj.object_id << 1)}>"\
129
- ", diff:\n"\
130
- "#{Assert::U.syscmd_diff_proc.call(@exp_obj_show, @act_obj_show)}"
131
- assert_equal exp, test_run_results(:fail).first.message
131
+ subject.run(&test_run_callback)
132
+
133
+ exp =
134
+ "Expected #<#{act_obj1.class}:#{"0x0%x" % (act_obj1.object_id << 1)}>"\
135
+ " to not be the same as"\
136
+ " #<#{act_obj1.class}:#{"0x0%x" % (act_obj1.object_id << 1)}>"\
137
+ ", diff:\n"\
138
+ "#{Assert::U.syscmd_diff_proc.call(act_obj_show1, act_obj_show1)}"
139
+ assert_that(test_run_results(:fail).first.message).equals(exp)
132
140
  end
133
141
  end
134
142
  end
135
-
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "assert"
2
4
  require "assert/assertions"
3
5
 
@@ -8,27 +10,27 @@ module Assert::Assertions
8
10
  include Assert::Test::TestHelpers
9
11
 
10
12
  desc "`assert_true`"
11
- setup do
12
- desc = @desc = "assert true fail desc"
13
- args = @args = ["whatever", desc]
14
- @test = Factory.test do
13
+ subject {
14
+ args = args1
15
+ Factory.test do
15
16
  assert_true(true) # pass
16
17
  assert_true(*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 true fail desc" }
22
+ let(:args1) { ["whatever", 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)
27
+
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)
28
31
 
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 true."
31
- assert_equal exp, test_run_results(:fail).first.message
32
+ exp = "#{args1[1]}\nExpected #{Assert::U.show(args1[0], config1)} to be true."
33
+ assert_that(test_run_results(:fail).first.message).equals(exp)
32
34
  end
33
35
  end
34
36
 
@@ -36,27 +38,27 @@ module Assert::Assertions
36
38
  include Assert::Test::TestHelpers
37
39
 
38
40
  desc "`assert_not_true`"
39
- setup do
40
- desc = @desc = "assert not true fail desc"
41
- args = @args = [true, desc]
42
- @test = Factory.test do
41
+ subject {
42
+ args = args1
43
+ Factory.test do
43
44
  assert_not_true(false) # pass
44
45
  assert_not_true(*args) # fail
45
46
  end
46
- @c = @test.config
47
- @test.run(&test_run_callback)
48
- end
49
- subject{ @test }
47
+ }
48
+
49
+ let(:desc1) { "assert not true fail desc" }
50
+ let(:args1) { [true, desc1] }
51
+ let(:config1) { subject.config }
50
52
 
51
53
  should "produce results as expected" do
52
- assert_equal 2, test_run_result_count
53
- assert_equal 1, test_run_result_count(:pass)
54
- assert_equal 1, test_run_result_count(:fail)
55
- end
54
+ subject.run(&test_run_callback)
55
+
56
+ assert_that(test_run_result_count).equals(2)
57
+ assert_that(test_run_result_count(:pass)).equals(1)
58
+ assert_that(test_run_result_count(:fail)).equals(1)
56
59
 
57
- should "have a fail message with custom and generic explanations" do
58
- exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0], @c)} to not be true."
59
- assert_equal exp, test_run_results(:fail).first.message
60
+ exp = "#{args1[1]}\nExpected #{Assert::U.show(args1[0], config1)} to not be true."
61
+ assert_that(test_run_results(:fail).first.message).equals(exp)
60
62
  end
61
63
  end
62
64
 
@@ -64,27 +66,27 @@ module Assert::Assertions
64
66
  include Assert::Test::TestHelpers
65
67
 
66
68
  desc "`assert_false`"
67
- setup do
68
- desc = @desc = "assert false fail desc"
69
- args = @args = ["whatever", desc]
70
- @test = Factory.test do
69
+ subject {
70
+ args = args1
71
+ Factory.test do
71
72
  assert_false(false) # pass
72
73
  assert_false(*args) # fail
73
74
  end
74
- @c = @test.config
75
- @test.run(&test_run_callback)
76
- end
77
- subject{ @test }
75
+ }
76
+
77
+ let(:desc1) { "assert false fail desc" }
78
+ let(:args1) { ["whatever", desc1] }
79
+ let(:config1) { subject.config }
78
80
 
79
81
  should "produce results as expected" do
80
- assert_equal 2, test_run_result_count
81
- assert_equal 1, test_run_result_count(:pass)
82
- assert_equal 1, test_run_result_count(:fail)
83
- end
82
+ subject.run(&test_run_callback)
83
+
84
+ assert_that(test_run_result_count).equals(2)
85
+ assert_that(test_run_result_count(:pass)).equals(1)
86
+ assert_that(test_run_result_count(:fail)).equals(1)
84
87
 
85
- should "have a fail message with custom and generic explanations" do
86
- exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0], @c)} to be false."
87
- assert_equal exp, test_run_results(:fail).first.message
88
+ exp = "#{args1[1]}\nExpected #{Assert::U.show(args1[0], config1)} to be false."
89
+ assert_that(test_run_results(:fail).first.message).equals(exp)
88
90
  end
89
91
  end
90
92
 
@@ -92,27 +94,27 @@ module Assert::Assertions
92
94
  include Assert::Test::TestHelpers
93
95
 
94
96
  desc "`assert_not_false`"
95
- setup do
96
- desc = @desc = "assert not false fail desc"
97
- args = @args = [false, desc]
98
- @test = Factory.test do
97
+ subject {
98
+ args = args1
99
+ Factory.test do
99
100
  assert_not_false(true) # pass
100
101
  assert_not_false(*args) # fail
101
102
  end
102
- @c = @test.config
103
- @test.run(&test_run_callback)
104
- end
105
- subject{ @test }
103
+ }
104
+
105
+ let(:desc1) { "assert not false fail desc" }
106
+ let(:args1) { [false, desc1] }
107
+ let(:config1) { subject.config }
106
108
 
107
109
  should "produce results as expected" do
108
- assert_equal 2, test_run_result_count
109
- assert_equal 1, test_run_result_count(:pass)
110
- assert_equal 1, test_run_result_count(:fail)
111
- end
110
+ subject.run(&test_run_callback)
111
+
112
+ assert_that(test_run_result_count).equals(2)
113
+ assert_that(test_run_result_count(:pass)).equals(1)
114
+ assert_that(test_run_result_count(:fail)).equals(1)
112
115
 
113
- should "have a fail message with custom and generic explanations" do
114
- exp = "#{@args[1]}\nExpected #{Assert::U.show(@args[0], @c)} to not be false."
115
- assert_equal exp, test_run_results(:fail).first.message
116
+ exp = "#{args1[1]}\nExpected #{Assert::U.show(args1[0], config1)} to not be false."
117
+ assert_that(test_run_results(:fail).first.message).equals(exp)
116
118
  end
117
119
  end
118
120
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "assert"
2
4
  require "assert/assertions"
3
5
 
@@ -6,52 +8,54 @@ module Assert::Assertions
6
8
  include Assert::Test::TestHelpers
7
9
 
8
10
  desc "Assert::Context"
9
- setup do
10
- @context_class = Factory.modes_off_context_class
11
- @test = Factory.test
12
- @context = @context_class.new(@test, @test.config, proc{ |r| })
13
- end
14
- subject{ @context }
11
+ subject { context_class1.new(test1, test1.config, proc { |r| }) }
12
+
13
+ let(:context_class1) { Factory.modes_off_context_class }
14
+ let(:test1) { Factory.test }
15
15
 
16
16
  should have_imeths :assert_block, :assert_not_block, :refute_block
17
- should have_imeths :assert_raises, :assert_not_raises
18
- should have_imeths :assert_raise, :assert_not_raise, :assert_nothing_raised
19
- should have_imeths :assert_kind_of, :assert_not_kind_of, :refute_kind_of
20
- should have_imeths :assert_instance_of, :assert_not_instance_of, :refute_instance_of
21
- should have_imeths :assert_respond_to, :assert_responds_to
22
- should have_imeths :assert_not_respond_to, :assert_not_responds_to
23
- should have_imeths :refute_respond_to, :refute_responds_to
24
- should have_imeths :assert_same, :assert_not_same, :refute_same
25
- should have_imeths :assert_equal, :assert_not_equal, :refute_equal
26
- should have_imeths :assert_match, :assert_not_match, :assert_no_match, :refute_match
27
17
  should have_imeths :assert_empty, :assert_not_empty, :refute_empty
18
+ should have_imeths :assert_equal, :assert_not_equal, :refute_equal
19
+ should have_imeths :assert_file_exists, :assert_not_file_exists, :refute_file_exists
28
20
  should have_imeths :assert_includes, :assert_not_includes
29
21
  should have_imeths :assert_included, :assert_not_included
30
22
  should have_imeths :refute_includes, :refute_included
23
+ should have_imeths :assert_instance_of, :assert_not_instance_of, :refute_instance_of
24
+ should have_imeths :assert_kind_of, :assert_not_kind_of, :refute_kind_of
25
+ should have_imeths :assert_match, :assert_not_match, :assert_no_match, :refute_match
31
26
  should have_imeths :assert_nil, :assert_not_nil, :refute_nil
32
27
  should have_imeths :assert_true, :assert_not_true, :refute_true
33
28
  should have_imeths :assert_false, :assert_not_false, :refute_false
34
- should have_imeths :assert_file_exists, :assert_not_file_exists, :refute_file_exists
29
+ should have_imeths :assert_raises, :assert_not_raises
30
+ should have_imeths :assert_raise, :assert_not_raise, :assert_nothing_raised
31
+ should have_imeths :assert_changes, :assert_not_changes, :refute_changes
32
+ should have_imeths :assert_respond_to, :assert_responds_to
33
+ should have_imeths :assert_not_respond_to, :assert_not_responds_to
34
+ should have_imeths :refute_respond_to, :refute_responds_to
35
+ should have_imeths :assert_same, :assert_not_same, :refute_same
35
36
  end
36
37
 
37
38
  class IgnoredTests < UnitTests
38
39
  desc "ignored assertions helpers"
39
40
  setup do
40
- @tests = Assert::Assertions::IGNORED_ASSERTION_HELPERS.map do |helper|
41
- context_info = Factory.context_info(@context_class)
41
+ tests.each{ |test| test.run(&test_run_callback) }
42
+ end
43
+
44
+ let(:tests) {
45
+ context_info = Factory.context_info(context_class1)
46
+ Assert::Assertions::IGNORED_ASSERTION_HELPERS.map do |helper|
42
47
  Factory.test("ignored assertion helper #{helper}", context_info) do
43
48
  self.send(helper, "doesn't matter")
44
49
  end
45
50
  end
46
- @tests.each{ |test| test.run(&test_run_callback) }
47
- end
51
+ }
48
52
 
49
53
  should "have an ignored result for each helper in the constant" do
50
54
  exp = Assert::Assertions::IGNORED_ASSERTION_HELPERS.size
51
- assert_equal exp, test_run_result_count
55
+ assert_that(test_run_result_count).equals(exp)
52
56
 
53
57
  test_run_results.each do |result|
54
- assert_kind_of Assert::Result::Ignore, result
58
+ assert_that(result).is_kind_of(Assert::Result::Ignore)
55
59
  end
56
60
  end
57
61
 
@@ -60,7 +64,7 @@ module Assert::Assertions
60
64
  "The assertion `#{helper}` is not supported."\
61
65
  " Please use another assertion or the basic `assert`."
62
66
  end
63
- assert_equal exp, test_run_results.collect(&:message)
67
+ assert_that(test_run_results.collect(&:message)).equals(exp)
64
68
  end
65
69
  end
66
70
  end