assert 2.18.3 → 2.19.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 (81) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -2
  3. data/assert.gemspec +11 -5
  4. data/bin/assert +1 -0
  5. data/lib/assert.rb +20 -6
  6. data/lib/assert/actual_value.rb +26 -8
  7. data/lib/assert/assert_runner.rb +38 -17
  8. data/lib/assert/assertions.rb +145 -41
  9. data/lib/assert/cli.rb +19 -66
  10. data/lib/assert/clirb.rb +55 -0
  11. data/lib/assert/config.rb +9 -7
  12. data/lib/assert/config_helpers.rb +57 -22
  13. data/lib/assert/context.rb +33 -49
  14. data/lib/assert/context/let_dsl.rb +10 -4
  15. data/lib/assert/context/method_missing.rb +3 -0
  16. data/lib/assert/context/setup_dsl.rb +24 -16
  17. data/lib/assert/context/subject_dsl.rb +26 -25
  18. data/lib/assert/context/suite_dsl.rb +5 -1
  19. data/lib/assert/context/test_dsl.rb +58 -19
  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 +27 -15
  23. data/lib/assert/default_view.rb +49 -30
  24. data/lib/assert/factory.rb +2 -0
  25. data/lib/assert/file_line.rb +8 -6
  26. data/lib/assert/macro.rb +3 -1
  27. data/lib/assert/macros/methods.rb +73 -45
  28. data/lib/assert/result.rb +117 -61
  29. data/lib/assert/runner.rb +70 -51
  30. data/lib/assert/stub.rb +44 -3
  31. data/lib/assert/suite.rb +76 -38
  32. data/lib/assert/test.rb +43 -44
  33. data/lib/assert/utils.rb +22 -11
  34. data/lib/assert/version.rb +3 -1
  35. data/lib/assert/view.rb +46 -18
  36. data/lib/assert/view_helpers.rb +102 -92
  37. data/test/helper.rb +8 -4
  38. data/test/support/factory.rb +40 -21
  39. data/test/support/inherited_stuff.rb +2 -0
  40. data/test/system/stub_tests.rb +272 -250
  41. data/test/system/test_tests.rb +89 -73
  42. data/test/unit/actual_value_tests.rb +103 -46
  43. data/test/unit/assert_tests.rb +49 -39
  44. data/test/unit/assertions/assert_block_tests.rb +14 -14
  45. data/test/unit/assertions/assert_changes_tests.rb +103 -0
  46. data/test/unit/assertions/assert_empty_tests.rb +18 -16
  47. data/test/unit/assertions/assert_equal_tests.rb +48 -32
  48. data/test/unit/assertions/assert_file_exists_tests.rb +19 -17
  49. data/test/unit/assertions/assert_includes_tests.rb +14 -14
  50. data/test/unit/assertions/assert_instance_of_tests.rb +18 -18
  51. data/test/unit/assertions/assert_is_a_tests.rb +128 -0
  52. data/test/unit/assertions/assert_match_tests.rb +14 -14
  53. data/test/unit/assertions/assert_nil_tests.rb +20 -16
  54. data/test/unit/assertions/assert_raises_tests.rb +36 -27
  55. data/test/unit/assertions/assert_respond_to_tests.rb +14 -14
  56. data/test/unit/assertions/assert_same_tests.rb +28 -32
  57. data/test/unit/assertions/assert_true_false_tests.rb +38 -32
  58. data/test/unit/assertions_tests.rb +25 -18
  59. data/test/unit/config_helpers_tests.rb +20 -9
  60. data/test/unit/config_tests.rb +16 -8
  61. data/test/unit/context/let_dsl_tests.rb +2 -0
  62. data/test/unit/context/setup_dsl_tests.rb +27 -15
  63. data/test/unit/context/subject_dsl_tests.rb +5 -4
  64. data/test/unit/context/suite_dsl_tests.rb +6 -5
  65. data/test/unit/context/test_dsl_tests.rb +43 -19
  66. data/test/unit/context_info_tests.rb +12 -3
  67. data/test/unit/context_tests.rb +166 -116
  68. data/test/unit/default_runner_tests.rb +2 -0
  69. data/test/unit/default_suite_tests.rb +17 -5
  70. data/test/unit/factory_tests.rb +5 -1
  71. data/test/unit/file_line_tests.rb +14 -12
  72. data/test/unit/macro_tests.rb +17 -10
  73. data/test/unit/result_tests.rb +72 -75
  74. data/test/unit/runner_tests.rb +38 -23
  75. data/test/unit/suite_tests.rb +48 -30
  76. data/test/unit/test_tests.rb +88 -102
  77. data/test/unit/utils_tests.rb +53 -36
  78. data/test/unit/view_helpers_tests.rb +25 -17
  79. data/test/unit/view_tests.rb +8 -5
  80. metadata +40 -9
  81. data/test/unit/assertions/assert_kind_of_tests.rb +0 -68
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "assert"
2
4
  require "assert/utils"
3
5
 
@@ -7,35 +9,40 @@ require "assert/config"
7
9
  module Assert::Utils
8
10
  class UnitTests < Assert::Context
9
11
  desc "Assert::Utils"
10
- subject { Assert::Utils }
12
+ subject{ unit_class }
13
+
14
+ let(:unit_class){ Assert::Utils }
11
15
 
12
- let(:objs1) { [1, "hi there", Hash.new, [:a, :b]] }
16
+ let(:objs1){ [1, "hi there", {}, [:a, :b]] }
13
17
 
14
18
  should have_imeths :show, :show_for_diff
15
19
  should have_imeths :tempfile
16
- should have_imeths :stdlib_pp_proc, :default_use_diff_proc, :syscmd_diff_proc
20
+ should have_imeths :stdlib_pp_proc, :default_use_diff_proc
21
+ should have_imeths :syscmd_diff_proc
17
22
  should have_imeths :git_changed_proc
18
23
  end
19
24
 
20
25
  class ShowTests < UnitTests
21
26
  desc "`show`"
22
27
 
23
- let(:pp_config1) {
28
+ let(:pp_config1) do
24
29
  Assert::Config.new({
25
- :pp_objects => true,
26
- :pp_proc => Proc.new{ |input| "herp derp" }
30
+ pp_objects: true,
31
+ pp_proc: Proc.new{ |_input| "herp derp" },
27
32
  })
28
- }
33
+ end
29
34
 
30
35
  should "use `inspect` to show objs when `pp_objects` setting is false" do
31
36
  objs1.each do |obj|
32
- assert_that(subject.show(obj, Factory.modes_off_config)).equals(obj.inspect)
37
+ assert_that(subject.show(obj, Factory.modes_off_config))
38
+ .equals(obj.inspect)
33
39
  end
34
40
  end
35
41
 
36
42
  should "use `pp_proc` to show objs when `pp_objects` setting is true" do
37
43
  objs1.each do |obj|
38
- assert_that(subject.show(obj, pp_config1)).equals(pp_config1.pp_proc.call(obj))
44
+ assert_that(subject.show(obj, pp_config1))
45
+ .equals(pp_config1.pp_proc.call(obj))
39
46
  end
40
47
  end
41
48
  end
@@ -43,24 +50,27 @@ module Assert::Utils
43
50
  class ShowForDiffTests < ShowTests
44
51
  desc "`show_for_diff`"
45
52
 
46
- let(:w_newlines1) { { :string => "herp derp, derp herp\nherpderpedia" } }
47
- let(:w_obj_id1) { Class.new.new }
53
+ let(:w_newlines1){ { string: "herp derp, derp herp\nherpderpedia" } }
54
+ let(:w_obj_id1){ Class.new.new }
48
55
 
49
56
  should "call show, escaping newlines" do
50
57
  exp_out = "{:string=>\"herp derp, derp herp\nherpderpedia\"}"
51
- assert_that(subject.show_for_diff(w_newlines1, Factory.modes_off_config)).equals(exp_out)
58
+ assert_that(subject.show_for_diff(w_newlines1, Factory.modes_off_config))
59
+ .equals(exp_out)
52
60
  end
53
61
 
54
62
  should "make any obj ids generic" do
55
63
  exp_out = "#<#<Class:0xXXXXXX>:0xXXXXXX>"
56
- assert_that(subject.show_for_diff(w_obj_id1, Factory.modes_off_config)).equals(exp_out)
64
+ assert_that(subject.show_for_diff(w_obj_id1, Factory.modes_off_config))
65
+ .equals(exp_out)
57
66
  end
58
67
  end
59
68
 
60
69
  class TempfileTests < UnitTests
61
70
  desc "`tempfile`"
62
71
 
63
- should "require tempfile, open a tempfile, write the given content, and yield it" do
72
+ should "require tempfile, open a tempfile, write the given content, "\
73
+ "and yield it" do
64
74
  subject.tempfile("a-name", "some-content") do |tmpfile|
65
75
  assert_that((require "tempfile")).equals(false)
66
76
  assert tmpfile
@@ -76,12 +86,12 @@ module Assert::Utils
76
86
  desc "`stdlib_pp_proc`"
77
87
 
78
88
  should "build a pp proc that uses stdlib `PP.pp` to pretty print objects" do
79
- exp_obj_pps = objs1.map{ |o| PP.pp(o, "", 79).strip }
89
+ exp_obj_pps = objs1.map{ |o| PP.pp(o, +"", 79).strip }
80
90
  act_obj_pps = objs1.map{ |o| subject.stdlib_pp_proc.call(o) }
81
91
  assert_that(act_obj_pps).equals(exp_obj_pps)
82
92
 
83
93
  cust_width = 1
84
- exp_obj_pps = objs1.map{ |o| PP.pp(o, "", cust_width).strip }
94
+ exp_obj_pps = objs1.map{ |o| PP.pp(o, +"", cust_width).strip }
85
95
  act_obj_pps = objs1.map{ |o| subject.stdlib_pp_proc(cust_width).call(o) }
86
96
  assert_that(act_obj_pps).equals(exp_obj_pps)
87
97
  end
@@ -90,8 +100,10 @@ module Assert::Utils
90
100
  class DefaultUseDiffProcTests < UnitTests
91
101
  desc "`default_use_diff_proc`"
92
102
 
93
- let(:longer1) { "i am a really long string output; use diff when working with me" }
94
- let(:newlines1) { "i have\n newlines" }
103
+ let(:longer1) do
104
+ "i am a really long string output; use diff when working with me"
105
+ end
106
+ let(:newlines1){ "i have\n newlines" }
95
107
 
96
108
  should "be true if either output has newlines or is bigger than 29 chars" do
97
109
  proc = subject.default_use_diff_proc
@@ -108,28 +120,33 @@ module Assert::Utils
108
120
  class SyscmdDiffProc < UnitTests
109
121
  desc "`syscmd_diff_proc`"
110
122
 
111
- let(:diff_a_file1) { File.join(ROOT_PATH, "test/support/diff_a.txt") }
112
- let(:diff_b_file1) { File.join(ROOT_PATH, "test/support/diff_b.txt") }
113
- let(:diff_a1) { File.read(diff_a_file1) }
114
- let(:diff_b1) { File.read(diff_b_file1) }
115
-
116
- should "use the diff syscmd to output the diff between the exp/act show output" do
117
- exp_diff_out = `diff --unified=-1 #{diff_a_file1} #{diff_b_file1}`.strip.tap do |out|
118
- out.sub!(/^\-\-\- .+/, "--- expected")
119
- out.sub!(/^\+\+\+ .+/, "+++ actual")
120
- end
121
-
122
- assert_that(subject.syscmd_diff_proc.call(diff_a1, diff_b1)).equals(exp_diff_out)
123
+ let(:diff_a_file1){ File.join(ROOT_PATH, "test/support/diff_a.txt") }
124
+ let(:diff_b_file1){ File.join(ROOT_PATH, "test/support/diff_b.txt") }
125
+ let(:diff_a1){ File.read(diff_a_file1) }
126
+ let(:diff_b1){ File.read(diff_b_file1) }
127
+
128
+ should "use the diff syscmd to output the diff between the exp/act "\
129
+ "show output" do
130
+ exp_diff_out =
131
+ `diff --unified=-1 #{diff_a_file1} #{diff_b_file1}`.strip.tap do |out|
132
+ out.sub!(/^\-\-\- .+/, "--- expected")
133
+ out.sub!(/^\+\+\+ .+/, "+++ actual")
134
+ end
135
+
136
+ assert_that(subject.syscmd_diff_proc.call(diff_a1, diff_b1))
137
+ .equals(exp_diff_out)
123
138
  end
124
139
 
125
140
  should "allow you to specify a custom syscmd" do
126
141
  cust_syscmd = "diff"
127
- exp_diff_out = `#{cust_syscmd} #{diff_a_file1} #{diff_b_file1}`.strip.tap do |out|
128
- out.sub!(/^\-\-\- .+/, "--- expected")
129
- out.sub!(/^\+\+\+ .+/, "+++ actual")
130
- end
131
-
132
- assert_that(subject.syscmd_diff_proc(cust_syscmd).call(diff_a1, diff_b1)).equals(exp_diff_out)
142
+ exp_diff_out =
143
+ `#{cust_syscmd} #{diff_a_file1} #{diff_b_file1}`.strip.tap do |out|
144
+ out.sub!(/^\-\-\- .+/, "--- expected")
145
+ out.sub!(/^\+\+\+ .+/, "+++ actual")
146
+ end
147
+
148
+ assert_that(subject.syscmd_diff_proc(cust_syscmd).call(diff_a1, diff_b1))
149
+ .equals(exp_diff_out)
133
150
  end
134
151
  end
135
152
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "assert"
2
4
  require "assert/view_helpers"
3
5
 
@@ -10,10 +12,9 @@ require "assert/view"
10
12
  module Assert::ViewHelpers
11
13
  class UnitTests < Assert::Context
12
14
  desc "Assert::ViewHelpers"
13
- subject { helpers_class1 }
15
+ subject{ unit_class }
14
16
 
15
- let(:test_opt_val1) { Factory.string }
16
- let(:helpers_class1) {
17
+ let(:unit_class) do
17
18
  test_opt_val = test_opt_val1
18
19
  Class.new do
19
20
  include Assert::ViewHelpers
@@ -26,7 +27,9 @@ module Assert::ViewHelpers
26
27
  @config ||= [Assert.config, Assert::Config.new].sample
27
28
  end
28
29
  end
29
- }
30
+ end
31
+
32
+ let(:test_opt_val1){ Factory.string }
30
33
 
31
34
  should have_imeths :option
32
35
 
@@ -35,7 +38,7 @@ module Assert::ViewHelpers
35
38
  end
36
39
 
37
40
  should "write option values" do
38
- helpers = helpers_class1.new
41
+ helpers = unit_class.new
39
42
  assert_that(helpers.test_opt).equals(test_opt_val1)
40
43
 
41
44
  new_val = Factory.integer
@@ -50,9 +53,7 @@ module Assert::ViewHelpers
50
53
 
51
54
  class InitTests < UnitTests
52
55
  desc "when init"
53
- subject { helpers1 }
54
-
55
- let(:helpers1) { helpers_class1.new }
56
+ subject{ unit_class.new }
56
57
 
57
58
  should have_imeths :captured_output, :re_run_test_cmd
58
59
  should have_imeths :tests_to_run_count_statement, :result_count_statement
@@ -76,7 +77,9 @@ module Assert::ViewHelpers
76
77
  end
77
78
 
78
79
  should "know its tests-to-run count and result count statements" do
79
- exp = "#{subject.tests_to_run_count} test#{"s" if subject.tests_to_run_count != 1}"
80
+ exp =
81
+ "#{subject.tests_to_run_count} "\
82
+ "test#{"s" if subject.tests_to_run_count != 1}"
80
83
  assert_that(subject.tests_to_run_count_statement).equals(exp)
81
84
 
82
85
  exp = "#{subject.result_count} result#{"s" if subject.result_count != 1}"
@@ -90,7 +93,7 @@ module Assert::ViewHelpers
90
93
  items = 2.times.map{ Factory.string }
91
94
  assert_that(subject.to_sentence(items)).equals(items.join(" and "))
92
95
 
93
- items = (Factory.integer(3)+2).times.map{ Factory.string }
96
+ items = (Factory.integer(3) + 2).times.map{ Factory.string }
94
97
  exp = [items[0..-2].join(", "), items.last].join(", and ")
95
98
  assert_that(subject.to_sentence(items)).equals(exp)
96
99
  end
@@ -102,7 +105,7 @@ module Assert::ViewHelpers
102
105
  Assert.stub(subject, :result_count){ 1 }
103
106
  assert_that(subject.all_pass_result_summary_msg).equals("pass")
104
107
 
105
- Assert.stub(subject, :result_count){ Factory.integer(10)+1 }
108
+ Assert.stub(subject, :result_count){ Factory.integer(10) + 1 }
106
109
  assert_that(subject.all_pass_result_summary_msg).equals("all pass")
107
110
  end
108
111
 
@@ -114,7 +117,7 @@ module Assert::ViewHelpers
114
117
 
115
118
  Assert.stub(subject, :all_pass?){ false }
116
119
  res_type = [:pass, :ignore, :fail, :skip, :error].sample
117
- exp = "#{subject.send("#{res_type}_result_count")} #{res_type.to_s}"
120
+ exp = "#{subject.send("#{res_type}_result_count")} #{res_type}"
118
121
  assert_that(subject.result_summary_msg(res_type)).equals(exp)
119
122
  end
120
123
 
@@ -138,7 +141,7 @@ module Assert::ViewHelpers
138
141
 
139
142
  class AnsiTests < UnitTests
140
143
  desc "Ansi"
141
- subject { Ansi }
144
+ subject{ Ansi }
142
145
 
143
146
  should have_imeths :code_for
144
147
 
@@ -161,10 +164,12 @@ module Assert::ViewHelpers
161
164
 
162
165
  class AnsiInitTests < UnitTests
163
166
  desc "when mixed in on a view"
164
- subject { view1 }
167
+ subject{ view1 }
165
168
 
166
- let(:view_class1) { Class.new(Assert::View){ include Ansi } }
167
- let(:view1) { view_class1.new(Factory.modes_off_config, StringIO.new("", "w+")) }
169
+ let(:view_class1){ Class.new(Assert::View){ include Ansi } }
170
+ let(:view1) do
171
+ view_class1.new(Factory.modes_off_config, StringIO.new(+"", "w+"))
172
+ end
168
173
 
169
174
  should have_imeths :ansi_styled_msg
170
175
 
@@ -189,7 +194,10 @@ module Assert::ViewHelpers
189
194
  Assert.stub(subject, "#{result_type}_styles"){ [] }
190
195
  assert_that(subject.ansi_styled_msg(msg, result_type)).equals(msg)
191
196
 
192
- styles = Factory.integer(3).times.map{ Assert::ViewHelpers::Ansi::CODES.keys.sample }
197
+ styles =
198
+ Factory.integer(3).times.map do
199
+ Assert::ViewHelpers::Ansi::CODES.keys.sample
200
+ end
193
201
  Assert.stub(subject, "#{result_type}_styles"){ styles }
194
202
  exp_code = Assert::ViewHelpers::Ansi.code_for(*styles)
195
203
  exp = exp_code + msg + Assert::ViewHelpers::Ansi.code_for(:reset)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "assert"
2
4
  require "assert/view"
3
5
 
@@ -9,7 +11,9 @@ require "assert/view_helpers"
9
11
  class Assert::View
10
12
  class UnitTests < Assert::Context
11
13
  desc "Assert::View"
12
- subject { Assert::View }
14
+ subject{ unit_class }
15
+
16
+ let(:unit_class){ Assert::View }
13
17
 
14
18
  should have_instance_method :require_user_view
15
19
 
@@ -24,11 +28,10 @@ class Assert::View
24
28
 
25
29
  class InitTests < UnitTests
26
30
  desc "when init"
27
- subject { view1 }
31
+ subject{ Assert::View.new(config1, io1) }
28
32
 
29
- let(:io1) { StringIO.new("", "w+") }
30
- let(:config1) { Factory.modes_off_config }
31
- let(:view1) { Assert::View.new(config1, io1) }
33
+ let(:io1){ StringIO.new(+"", "w+") }
34
+ let(:config1){ Factory.modes_off_config }
32
35
 
33
36
  should have_readers :config
34
37
  should have_imeths :view, :is_tty?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assert
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.18.3
4
+ version: 2.19.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding
@@ -9,36 +9,64 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-09-01 00:00:00.000000000 Z
12
+ date: 2021-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: much-style-guide
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 0.5.0
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 0.5.0
14
28
  - !ruby/object:Gem::Dependency
15
29
  name: much-factory
16
30
  requirement: !ruby/object:Gem::Requirement
17
31
  requirements:
18
32
  - - "~>"
19
33
  - !ruby/object:Gem::Version
20
- version: 0.1.0
34
+ version: 0.2.1
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.2.1
42
+ - !ruby/object:Gem::Dependency
43
+ name: much-not-given
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 0.1.2
21
49
  type: :runtime
22
50
  prerelease: false
23
51
  version_requirements: !ruby/object:Gem::Requirement
24
52
  requirements:
25
53
  - - "~>"
26
54
  - !ruby/object:Gem::Version
27
- version: 0.1.0
55
+ version: 0.1.2
28
56
  - !ruby/object:Gem::Dependency
29
57
  name: much-stub
30
58
  requirement: !ruby/object:Gem::Requirement
31
59
  requirements:
32
60
  - - "~>"
33
61
  - !ruby/object:Gem::Version
34
- version: 0.1.4
62
+ version: 0.1.7
35
63
  type: :runtime
36
64
  prerelease: false
37
65
  version_requirements: !ruby/object:Gem::Requirement
38
66
  requirements:
39
67
  - - "~>"
40
68
  - !ruby/object:Gem::Version
41
- version: 0.1.4
69
+ version: 0.1.7
42
70
  description: Assertion style testing framework.
43
71
  email:
44
72
  - kelly@kellyredding.com
@@ -58,6 +86,7 @@ files:
58
86
  - lib/assert/assert_runner.rb
59
87
  - lib/assert/assertions.rb
60
88
  - lib/assert/cli.rb
89
+ - lib/assert/clirb.rb
61
90
  - lib/assert/config.rb
62
91
  - lib/assert/config_helpers.rb
63
92
  - lib/assert/context.rb
@@ -95,12 +124,13 @@ files:
95
124
  - test/unit/actual_value_tests.rb
96
125
  - test/unit/assert_tests.rb
97
126
  - test/unit/assertions/assert_block_tests.rb
127
+ - test/unit/assertions/assert_changes_tests.rb
98
128
  - test/unit/assertions/assert_empty_tests.rb
99
129
  - test/unit/assertions/assert_equal_tests.rb
100
130
  - test/unit/assertions/assert_file_exists_tests.rb
101
131
  - test/unit/assertions/assert_includes_tests.rb
102
132
  - test/unit/assertions/assert_instance_of_tests.rb
103
- - test/unit/assertions/assert_kind_of_tests.rb
133
+ - test/unit/assertions/assert_is_a_tests.rb
104
134
  - test/unit/assertions/assert_match_tests.rb
105
135
  - test/unit/assertions/assert_nil_tests.rb
106
136
  - test/unit/assertions/assert_raises_tests.rb
@@ -148,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
178
  - !ruby/object:Gem::Version
149
179
  version: '0'
150
180
  requirements: []
151
- rubygems_version: 3.1.2
181
+ rubygems_version: 3.2.4
152
182
  signing_key:
153
183
  specification_version: 4
154
184
  summary: Assertion style testing framework.
@@ -163,12 +193,13 @@ test_files:
163
193
  - test/unit/actual_value_tests.rb
164
194
  - test/unit/assert_tests.rb
165
195
  - test/unit/assertions/assert_block_tests.rb
196
+ - test/unit/assertions/assert_changes_tests.rb
166
197
  - test/unit/assertions/assert_empty_tests.rb
167
198
  - test/unit/assertions/assert_equal_tests.rb
168
199
  - test/unit/assertions/assert_file_exists_tests.rb
169
200
  - test/unit/assertions/assert_includes_tests.rb
170
201
  - test/unit/assertions/assert_instance_of_tests.rb
171
- - test/unit/assertions/assert_kind_of_tests.rb
202
+ - test/unit/assertions/assert_is_a_tests.rb
172
203
  - test/unit/assertions/assert_match_tests.rb
173
204
  - test/unit/assertions/assert_nil_tests.rb
174
205
  - test/unit/assertions/assert_raises_tests.rb
@@ -1,68 +0,0 @@
1
- require "assert"
2
- require "assert/assertions"
3
-
4
- require "assert/utils"
5
-
6
- module Assert::Assertions
7
- class AssertKindOfTests < Assert::Context
8
- include Assert::Test::TestHelpers
9
-
10
- desc "`assert_kind_of`"
11
- subject { test1 }
12
-
13
- let(:desc1) { "assert kind of fail desc" }
14
- let(:args1) { [Array, "object", desc1] }
15
- let(:test1) {
16
- args = args1
17
- Factory.test do
18
- assert_kind_of(String, "object") # pass
19
- assert_kind_of(*args) # fail
20
- end
21
- }
22
- let(:config1) { test1.config }
23
-
24
- should "produce results as expected" do
25
- subject.run(&test_run_callback)
26
-
27
- assert_that(test_run_result_count).equals(2)
28
- assert_that(test_run_result_count(:pass)).equals(1)
29
- assert_that(test_run_result_count(:fail)).equals(1)
30
-
31
- exp =
32
- "#{args1[2]}\nExpected #{Assert::U.show(args1[1], config1)} (#{args1[1].class})"\
33
- " to be a kind of #{args1[0]}."
34
- assert_that(test_run_results(:fail).first.message).equals(exp)
35
- end
36
- end
37
-
38
- class AssertNotKindOfTests < Assert::Context
39
- include Assert::Test::TestHelpers
40
-
41
- desc "`assert_not_kind_of`"
42
- subject { test1 }
43
-
44
- let(:desc1) { "assert not kind of fail desc" }
45
- let(:args1) { [String, "object", desc1] }
46
- let(:test1) {
47
- args = args1
48
- Factory.test do
49
- assert_not_kind_of(*args) # fail
50
- assert_not_kind_of(Array, "object") # pass
51
- end
52
- }
53
- let(:config1) { test1.config }
54
-
55
- should "produce results as expected" do
56
- subject.run(&test_run_callback)
57
-
58
- assert_that(test_run_result_count).equals(2)
59
- assert_that(test_run_result_count(:pass)).equals(1)
60
- assert_that(test_run_result_count(:fail)).equals(1)
61
-
62
- exp =
63
- "#{args1[2]}\nExpected #{Assert::U.show(args1[1], config1)} (#{args1[1].class})"\
64
- " to not be a kind of #{args1[0]}."
65
- assert_that(test_run_results(:fail).first.message).equals(exp)
66
- end
67
- end
68
- end