sixarm_ruby_minitest_equal_collection 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c621681113f3a8160ea03b92e570bebf99880b45
4
+ data.tar.gz: 779e7c18f08cadc8dd04b7afb8b64e2783ed0b3c
5
+ SHA512:
6
+ metadata.gz: 255cbdf8967fbe2f69db6d834144108186138c1a2b243d89f763e382b43937e1c48ac08c1e4cd2ae5d8436a27ba4435ec64184de6ea5882cbb7a46be1b1e7d24
7
+ data.tar.gz: 2ec5aac7a02cf0c6f6008a479427673343e2d72abb39faf910f2b5dfca34edd3de18b2389f6d02c93a8b35369394c7f5cbc7ca4cc345f2a5b50de0c6bd7eed5c
@@ -0,0 +1,5 @@
1
+ �o��{]����m�K�[58'$T���N��~\Io`5��6��'��p��K�c_Qot�ڈ�qz����pN�%0�U�$G\�������Z���mZ��K'��Z��S���m��}s��<RiV()�.Z����������4|ڼL�)-+Wu9~D�ٳ?�^�S
2
+ ���� �����������#סU ��.#�����2tdbc3�\���ܞ� �M�ڢ ��#���ۖ�Mke|���웛���=0���ك����)�����0���_�)s�)Xu�� @�C�^�
3
+ S%כ߬�%���[6�[�H7}� �sֽ[42k�6�_r��l�u"�eTׇ�ni`���W �\��h�� ��%��9!<���czP�j>�}�-��2�.�
4
+ WobX��0�[���>Ӟ1�-�je����E��}qB�H����{M�q��
5
+ |�Viբ7@�o2�����|�,S<�H2�$���χ���,F�*Cc���v$�|f����h� �{ND��f��9�� �
@@ -0,0 +1,4 @@
1
+ ι'8B��c�<ci9�����O���)$�ݸ,8x��
2
+ _�߸�E����[U���Ou�qOlù��������<�EJ!���DQ�HP41\�j��_yM
3
+ ��s�V <�C���d��͐��c ��P�,��T�x�� ��.8�5IgYOv�����b�S�Md����Ҫ���U���o�t�tO��R�G\"�{���]:�����u�M���GHZ�R��6�_*��u��$S��Q+��t���z�fF����q�\f�Z��&�n�tU�! �o� ;Nj�
4
+ O�t���a��b1R�൘�S�J����J��*�Zblg7��x�� ��
@@ -0,0 +1,10 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "rake"
3
+ require "rake/testtask"
4
+
5
+ task :default => :test
6
+
7
+ Rake::TestTask.new(:test) do |t|
8
+ t.libs.push("lib", "test")
9
+ t.pattern = "test/**/*.rb"
10
+ end
@@ -0,0 +1,18 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin rdoc
3
+ Please see README
4
+ =end
5
+
6
+ unless defined?(Minitest) then
7
+ # Minitest 5 and MiniTest 4 use different capitalizations.
8
+ module Minitest; end
9
+ MiniTest = Minitest # prevents minitest.rb from requiring back to us
10
+ require "minitest"
11
+ end
12
+
13
+ MiniTest = Minitest unless defined?(MiniTest)
14
+
15
+ require 'hashdiff'
16
+
17
+ require 'sixarm_ruby_minitest_equal_collection/minitest/assertions/equal_collection'
18
+ require 'sixarm_ruby_minitest_equal_collection/minitest/expectations/equal_collection'
@@ -0,0 +1,51 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin rdoc
3
+ Please see README
4
+ =end
5
+
6
+ module MiniTest::Assertions
7
+
8
+ ##
9
+ # Succeeds when +exp+ and +act+ contain equal items and counts, regardless of order.
10
+
11
+ def assert_equal_collection(expect, actual, msg = nil)
12
+ shared_equal_collection(expect, actual, msg)
13
+ diff = shared_diff(expect, actual)
14
+ assert diff.empty?,
15
+ "Expected collections to have the same items. Expect: #{ expect.inspect }. Actual #{ actual.inspect }. Diff: #{ diff.inspect }." + append_msg(msg)
16
+ end
17
+
18
+ ##
19
+ # Succeeds when +exp+ and +act+ contain different items and/or counts, regardless of order.
20
+
21
+ def refute_equal_collection(expect, actual, msg = nil)
22
+ shared_equal_collection(expect, actual)
23
+ diff = shared_diff(expect, actual)
24
+ refute diff.empty?,
25
+ "Expected collections to not have the same items. Expect: #{ expect.inspect }. Actual: #{ actual.inspect }. Diff: #{ diff.inspect }" + append_msg(msg)
26
+ end
27
+
28
+ private
29
+
30
+ def shared_equal_collection(expect, actual, msg = nil)
31
+ refute_nil(expect, "Expected `expect`, but got nil." + append_msg(msg))
32
+ refute_nil(actual, "Expected `actual`, but got nil." + append_msg(msg))
33
+ assert_respond_to(expect, :each, "Expected `expect` to respond to each." + append_msg(msg))
34
+ assert_respond_to(actual, :each, "Expected `actual` to respond to each." + append_msg(msg))
35
+ end
36
+
37
+ def append_msg(msg)
38
+ msg ? " #{msg}" : ""
39
+ end
40
+
41
+ def countize(a)
42
+ h = Hash.new(0)
43
+ a.each{|x| h[x] += 1}
44
+ h
45
+ end
46
+
47
+ def shared_diff(a, b)
48
+ HashDiff.diff countize(a), countize(b)
49
+ end
50
+
51
+ end
@@ -0,0 +1,10 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin rdoc
3
+ Please see README
4
+ =end
5
+
6
+ module Minitest::Expectations
7
+ infect_an_assertion :assert_equal_collection, :must_equal_collection
8
+ infect_an_assertion :refute_equal_collection, :wont_equal_collection
9
+ end
10
+
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "simplecov"
4
+ SimpleCov.start
5
+ require "sixarm_ruby_minitest_equal_collection"
6
+
7
+ require "sixarm_ruby_minitest_equal_collection_test/minitest/assertions/equal_collection_test"
8
+ require "sixarm_ruby_minitest_equal_collection_test/minitest/expectations/equal_collection_test"
@@ -0,0 +1,364 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "sixarm_ruby_minitest_equal_collection"
3
+
4
+ describe "Minitest" do
5
+
6
+ describe "Assertions" do
7
+
8
+ describe "#assert_equal_collection" do
9
+
10
+ describe "empty collections => pass" do
11
+
12
+ describe "with array" do
13
+
14
+ specify "both empty => pass" do
15
+ assert_equal_collection([], [])
16
+ end
17
+
18
+ specify "only one empty => fail" do
19
+ err = proc {
20
+ assert_equal_collection([], [:a])
21
+ }.must_raise MiniTest::Assertion
22
+ err.message.must_match(/\bhave the same items\b/)
23
+ end
24
+
25
+ end
26
+
27
+ describe "with hash" do
28
+
29
+ specify "with both empty => pass" do
30
+ assert_equal_collection({}, {})
31
+ end
32
+
33
+ specify "with one empty => fail" do
34
+ err = proc {
35
+ assert_equal_collection({}, {a: 1})
36
+ }.must_raise MiniTest::Assertion
37
+ err.message.must_match(/\bhave the same items\b/)
38
+ end
39
+
40
+ end
41
+
42
+ end
43
+
44
+ describe "equal collections => pass" do
45
+
46
+ describe "with array" do
47
+
48
+ specify "with equal => pass" do
49
+ assert_equal_collection([:a], [:a])
50
+ end
51
+
52
+ specify "with unequal => fail" do
53
+ err = proc {
54
+ assert_equal_collection([:a], [:b])
55
+ }.must_raise MiniTest::Assertion
56
+ err.message.must_match(/\bhave the same items\b/)
57
+ end
58
+
59
+ end
60
+
61
+ describe "with hash" do
62
+
63
+ specify "with equal => pass" do
64
+ assert_equal_collection({a: 1}, {a: 1})
65
+ end
66
+
67
+ specify "with unequal => fail" do
68
+ err = proc {
69
+ assert_equal_collection({a: 1}, {b: 1})
70
+ }.must_raise MiniTest::Assertion
71
+ err.message.must_match(/\bhave the same items\b/)
72
+ end
73
+
74
+ end
75
+
76
+ end
77
+
78
+ describe "count is relevant" do
79
+
80
+ describe "with array" do
81
+
82
+ specify "with equal count => pass" do
83
+ assert_equal_collection([:a], [:a])
84
+ end
85
+
86
+ specify "with unequal count => fail" do
87
+ err = proc {
88
+ assert_equal_collection([:a], [:a, :a])
89
+ }.must_raise MiniTest::Assertion
90
+ err.message.must_match(/\bhave the same items\b/)
91
+ end
92
+
93
+ end
94
+
95
+ describe "with hash" do
96
+
97
+ specify "with equal count => pass" do
98
+ assert_equal_collection({a: 1}, {a: 1})
99
+ end
100
+
101
+ specify "with unequal count => fail" do
102
+ err = proc {
103
+ assert_equal_collection({a: 1}, {a: 1, b: 1})
104
+ }.must_raise MiniTest::Assertion
105
+ err.message.must_match(/\bhave the same items\b/)
106
+ end
107
+
108
+ end
109
+
110
+ end
111
+
112
+ describe "order is irrelevant" do
113
+
114
+ describe "with array" do
115
+
116
+ specify "with same items and same order => pass" do
117
+ assert_equal_collection([:a, :b], [:a, :b])
118
+ end
119
+
120
+ specify "with same items and different order => pass" do
121
+ assert_equal_collection([:a, :b], [:b, :a])
122
+ end
123
+
124
+ end
125
+
126
+ describe "with hash" do
127
+
128
+ specify "with same order => pass" do
129
+ assert_equal_collection({a: 1, b: 2}, {a: 1, b: 2})
130
+ end
131
+
132
+ specify "with different order => pass" do
133
+ assert_equal_collection({a: 1, b: 2}, {b: 2, a: 1})
134
+ end
135
+
136
+ end
137
+
138
+ end
139
+
140
+ describe "with degenerate cases" do
141
+
142
+ describe "with actual nil" do
143
+
144
+ specify "raise" do
145
+ err = proc {
146
+ assert_equal_collection([], nil)
147
+ }.must_raise MiniTest::Assertion
148
+ err.message.must_match(/\bactual\b.*\bnil\b/)
149
+ end
150
+
151
+ end
152
+
153
+ describe "with expect nil" do
154
+
155
+ specify "raise" do
156
+ err = proc {
157
+ assert_equal_collection(nil, [])
158
+ }.must_raise MiniTest::Assertion
159
+ err.message.must_match(/\bexpect\b.*\bnil\b/)
160
+ end
161
+
162
+ end
163
+
164
+ describe "with actual that does not respond to each" do
165
+
166
+ specify "raise" do
167
+ err = proc {
168
+ assert_equal_collection([], Object.new)
169
+ }.must_raise MiniTest::Assertion
170
+ err.message.must_match(/\bactual\b.*\brespond to each\b/)
171
+ end
172
+
173
+ end
174
+
175
+ describe "with expect that does not respond to each" do
176
+
177
+ specify "raise" do
178
+ err = proc {
179
+ assert_equal_collection(Object.new, [])
180
+ }.must_raise MiniTest::Assertion
181
+ err.message.must_match(/\bexpect\b.*\brespond to each\b/)
182
+ end
183
+
184
+ end
185
+
186
+ end
187
+
188
+ end
189
+
190
+ describe "#refute_equal_collection" do
191
+
192
+ describe "empty collections => fail" do
193
+
194
+ describe "with array" do
195
+
196
+ specify "both empty => fail" do
197
+ err = proc {
198
+ refute_equal_collection([], [])
199
+ }.must_raise MiniTest::Assertion
200
+ err.message.must_match(/\bhave the same items\b/)
201
+ end
202
+
203
+ specify "only one empty => pass" do
204
+ refute_equal_collection([], [:a])
205
+ end
206
+
207
+ end
208
+
209
+ describe "with hash" do
210
+
211
+ specify "with both empty => fail" do
212
+ err = proc {
213
+ refute_equal_collection({}, {})
214
+ }.must_raise MiniTest::Assertion
215
+ err.message.must_match(/\bhave the same items\b/)
216
+ end
217
+
218
+ specify "with one empty => pass" do
219
+ refute_equal_collection({}, {a: 1})
220
+ end
221
+
222
+ end
223
+
224
+ end
225
+
226
+ describe "equal collections => fail" do
227
+
228
+ describe "with array" do
229
+
230
+ specify "with equal => fail" do
231
+ err = proc {
232
+ refute_equal_collection([:a], [:a])
233
+ }.must_raise MiniTest::Assertion
234
+ err.message.must_match(/\bhave the same items\b/)
235
+ end
236
+
237
+ specify "with unequal => succes" do
238
+ refute_equal_collection([:a], [:b])
239
+ end
240
+
241
+ end
242
+
243
+ describe "with hash" do
244
+
245
+ specify "with equal => fail" do
246
+ err = proc {
247
+ refute_equal_collection({a: 1}, {a: 1})
248
+ }.must_raise MiniTest::Assertion
249
+ err.message.must_match(/\bhave the same items\b/)
250
+ end
251
+
252
+ specify "with unequal => pass" do
253
+ refute_equal_collection({a: 1}, {b: 1})
254
+ end
255
+
256
+ end
257
+
258
+ end
259
+
260
+ describe "count is relevant" do
261
+
262
+ describe "with array" do
263
+
264
+ specify "with equal count => fail" do
265
+ err = proc {
266
+ refute_equal_collection([:a], [:a])
267
+ }.must_raise MiniTest::Assertion
268
+ err.message.must_match(/\bhave the same items\b/)
269
+ end
270
+
271
+ specify "with unequal count => pass" do
272
+ refute_equal_collection([:a], [:a, :a])
273
+ end
274
+
275
+ end
276
+
277
+ describe "with hash" do
278
+
279
+ specify "with equal count => fail" do
280
+ err = proc {
281
+ refute_equal_collection({a: 1}, {a: 1})
282
+ }.must_raise MiniTest::Assertion
283
+ err.message.must_match(/\bhave the same items\b/)
284
+ end
285
+
286
+ specify "with unequal count => pass" do
287
+ refute_equal_collection({a: 1}, {a: 1, b: 1})
288
+ end
289
+
290
+ end
291
+
292
+ end
293
+
294
+ describe "order is irrelevant" do
295
+
296
+ describe "with array" do
297
+
298
+ specify "with same items and same order => fail" do
299
+ err = proc {
300
+ refute_equal_collection([:a, :b], [:a, :b])
301
+ }.must_raise MiniTest::Assertion
302
+ err.message.must_match(/\bhave the same items\b/)
303
+ end
304
+
305
+ specify "with same items but different order => fail" do
306
+ err = proc {
307
+ refute_equal_collection([:a, :b], [:b, :a])
308
+ }.must_raise MiniTest::Assertion
309
+ err.message.must_match(/\bhave the same items\b/)
310
+ end
311
+
312
+ end
313
+
314
+ describe "with hash" do
315
+
316
+ specify "with same items and same order => fail" do
317
+ err = proc {
318
+ refute_equal_collection({a: 1, b: 2}, {a: 1, b: 2})
319
+ }.must_raise MiniTest::Assertion
320
+ err.message.must_match(/\bhave the same items\b/)
321
+ end
322
+
323
+ specify "with same items and different order => fail" do
324
+ err = proc {
325
+ refute_equal_collection({a: 1, b: 2}, {b: 2, a: 1})
326
+ }.must_raise MiniTest::Assertion
327
+ err.message.must_match(/\bhave the same items\b/)
328
+ end
329
+
330
+ end
331
+
332
+ end
333
+
334
+ describe "with degenerate cases" do
335
+
336
+ describe "with nil" do
337
+
338
+ specify "raise an error that explains nil" do
339
+ err = proc {
340
+ assert_equal_collection(nil, nil)
341
+ }.must_raise MiniTest::Assertion
342
+ err.message.must_match(/\bgot nil\b/)
343
+ end
344
+
345
+ end
346
+
347
+ describe "with an object that does not respond to each" do
348
+
349
+ specify "raise an error that explains respond to each" do
350
+ err = proc {
351
+ assert_equal_collection(Object.new, Object.new)
352
+ }.must_raise MiniTest::Assertion
353
+ err.message.must_match(/\brespond to each\b/)
354
+ end
355
+
356
+ end
357
+
358
+ end
359
+
360
+ end
361
+
362
+ end
363
+
364
+ end
@@ -0,0 +1,370 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "sixarm_ruby_minitest_equal_collection"
3
+
4
+ describe "Minitest" do
5
+
6
+ describe "Expectations" do
7
+
8
+ describe "#must_equal_collection" do
9
+
10
+ describe "empty collections => pass" do
11
+
12
+ describe "with array" do
13
+
14
+ specify "both empty => pass" do
15
+ expect([]).must_equal_collection []
16
+ end
17
+
18
+ specify "only one empty => fail" do
19
+ proc {
20
+ expect([]).must_equal_collection [:a]
21
+ }.must_raise MiniTest::Assertion
22
+ end
23
+
24
+ end
25
+
26
+ describe "with hash" do
27
+
28
+ specify "with both empty => pass" do
29
+ expect({}).must_equal_collection({})
30
+ end
31
+
32
+ specify "with one empty => fail" do
33
+ proc {
34
+ expect({}).must_equal_collection({a: 1})
35
+ }.must_raise MiniTest::Assertion
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+
42
+ describe "equal collections => pass" do
43
+
44
+ describe "with array" do
45
+
46
+ specify "with equal => pass" do
47
+ expect([:a]).must_equal_collection [:a]
48
+ end
49
+
50
+ specify "with unequal => fail" do
51
+ proc {
52
+ expect([:a]).must_equal_collection [:b]
53
+ }.must_raise MiniTest::Assertion
54
+ end
55
+
56
+ end
57
+
58
+ describe "with hash" do
59
+
60
+ specify "with equal => pass" do
61
+ expect({a: 1}).must_equal_collection({a: 1})
62
+ end
63
+
64
+ specify "with unequal => fail" do
65
+ proc {
66
+ expect({a: 1}).must_equal_collection({b: 1})
67
+ }.must_raise MiniTest::Assertion
68
+ end
69
+
70
+ end
71
+
72
+ end
73
+
74
+ describe "count is relevant" do
75
+
76
+ describe "with array" do
77
+
78
+ specify "with equal count => pass" do
79
+ expect([:a]).must_equal_collection [:a]
80
+ end
81
+
82
+ specify "with unequal count => fail" do
83
+ proc {
84
+ expect([:a]).must_equal_collection [:a, :a]
85
+ }.must_raise MiniTest::Assertion
86
+ end
87
+
88
+ end
89
+
90
+ describe "with hash" do
91
+
92
+ specify "with equal count => pass" do
93
+ expect({a: 1}).must_equal_collection({a: 1})
94
+ end
95
+
96
+ specify "with unequal count => fail" do
97
+ proc {
98
+ expect({a: 1}).must_equal_collection({a: 1, b: 1})
99
+ }.must_raise MiniTest::Assertion
100
+ end
101
+
102
+ end
103
+
104
+ end
105
+
106
+ describe "order is irrelevant" do
107
+
108
+ describe "with array" do
109
+
110
+ specify "with same items and same order => pass" do
111
+ expect([:a, :b]).must_equal_collection [:a, :b]
112
+ end
113
+
114
+ specify "with same items and different order => pass" do
115
+ expect([:a, :b]).must_equal_collection [:b, :a]
116
+ end
117
+
118
+ end
119
+
120
+ describe "with hash" do
121
+
122
+ specify "with same order => pass" do
123
+ expect({a: 1, b: 2}).must_equal_collection({a: 1, b: 2})
124
+ end
125
+
126
+ specify "with different order => pass" do
127
+ expect({a: 1, b: 2}).must_equal_collection({b: 2, a: 1})
128
+ end
129
+
130
+ end
131
+
132
+ end
133
+
134
+ describe "with degenerate cases" do
135
+
136
+ describe "with `actual` nil" do
137
+
138
+ specify "raise" do
139
+ err = proc {
140
+ expect(nil).must_equal_collection []
141
+ }.must_raise MiniTest::Assertion
142
+ err.message.must_match(/\bactual\b.*\bnil\b/)
143
+ end
144
+
145
+ end
146
+
147
+ describe "with `expect` nil" do
148
+
149
+ specify "raise" do
150
+ err = proc {
151
+ expect([]).must_equal_collection nil
152
+ }.must_raise MiniTest::Assertion
153
+ err.message.must_match(/\bexpect\b.*\bnil\b/)
154
+ end
155
+
156
+ end
157
+
158
+ describe "with `actual` that does not respond to each" do
159
+
160
+ specify "raise" do
161
+ err = proc {
162
+ expect(Object.new).must_equal_collection []
163
+ }.must_raise MiniTest::Assertion
164
+ err.message.must_match(/\bactual\b.*\brespond to each\b/)
165
+ end
166
+
167
+ end
168
+
169
+ describe "with `expect` that does not respond to each" do
170
+
171
+ specify "raise" do
172
+ err = proc {
173
+ expect([]).must_equal_collection Object.new
174
+ }.must_raise MiniTest::Assertion
175
+ err.message.must_match(/\bexpect\b.*\brespond to each\b/)
176
+ end
177
+
178
+ end
179
+
180
+ end
181
+
182
+ end
183
+
184
+ describe "#wont_equal_collection" do
185
+
186
+ describe "empty collections => fail" do
187
+
188
+ describe "with array" do
189
+
190
+ specify "both empty => fail" do
191
+ proc {
192
+ expect([]).wont_equal_collection []
193
+ }.must_raise MiniTest::Assertion
194
+ end
195
+
196
+ specify "only one empty => pass" do
197
+ expect([]).wont_equal_collection [:a]
198
+ end
199
+
200
+ end
201
+
202
+ describe "with hash" do
203
+
204
+ specify "with both empty => fail" do
205
+ proc {
206
+ expect({}).wont_equal_collection({})
207
+ }.must_raise MiniTest::Assertion
208
+ end
209
+
210
+ specify "with one empty => pass" do
211
+ expect({}).wont_equal_collection({a: 1})
212
+ end
213
+
214
+ end
215
+
216
+ end
217
+
218
+ describe "equal collections => fail" do
219
+
220
+ describe "with array" do
221
+
222
+ specify "with equal => fail" do
223
+ proc {
224
+ expect([:a]).wont_equal_collection [:a]
225
+ }.must_raise MiniTest::Assertion
226
+ end
227
+
228
+ specify "with unequal => succes" do
229
+ expect([:a]).wont_equal_collection [:b]
230
+ end
231
+
232
+ end
233
+
234
+ describe "with hash" do
235
+
236
+ specify "with equal => fail" do
237
+ proc {
238
+ expect({a: 1}).wont_equal_collection({a: 1})
239
+ }.must_raise MiniTest::Assertion
240
+ end
241
+
242
+ specify "with unequal => pass" do
243
+ expect({a: 1}).wont_equal_collection({b: 1})
244
+ end
245
+
246
+ end
247
+
248
+ end
249
+
250
+ describe "count is relevant" do
251
+
252
+ describe "with array" do
253
+
254
+ specify "with equal count => fail" do
255
+ proc {
256
+ expect([:a]).wont_equal_collection [:a]
257
+ }.must_raise MiniTest::Assertion
258
+ end
259
+
260
+ specify "with unequal count => pass" do
261
+ expect([:a]).wont_equal_collection [:a, :a]
262
+ end
263
+
264
+ end
265
+
266
+ describe "with hash" do
267
+
268
+ specify "with equal count => fail" do
269
+ proc {
270
+ expect({a: 1}).wont_equal_collection({a: 1})
271
+ }.must_raise MiniTest::Assertion
272
+ end
273
+
274
+ specify "with unequal count => pass" do
275
+ expect({a: 1}).wont_equal_collection({a: 1, b: 1})
276
+ end
277
+
278
+ end
279
+
280
+ end
281
+
282
+ describe "order is irrelevant" do
283
+
284
+ describe "with array" do
285
+
286
+ specify "with same items and same order => fail" do
287
+ proc {
288
+ expect([:a, :b]).wont_equal_collection [:a, :b]
289
+ }.must_raise MiniTest::Assertion
290
+ end
291
+
292
+ specify "with same items but different order => fail" do
293
+ proc {
294
+ expect([:a, :b]).wont_equal_collection [:b, :a]
295
+ }.must_raise MiniTest::Assertion
296
+ end
297
+
298
+ end
299
+
300
+ describe "with hash" do
301
+
302
+ specify "with same items and same order => fail" do
303
+ proc {
304
+ expect({a: 1, b: 2}).wont_equal_collection({a: 1, b: 2})
305
+ }.must_raise MiniTest::Assertion
306
+ end
307
+
308
+ specify "with same items and different order => fail" do
309
+ proc {
310
+ expect({a: 1, b: 2}).wont_equal_collection({b: 2, a: 1})
311
+ }.must_raise MiniTest::Assertion
312
+ end
313
+
314
+ end
315
+
316
+ end
317
+
318
+ describe "with degenerate cases" do
319
+
320
+ describe "with `actual` nil" do
321
+
322
+ specify "raise" do
323
+ err = proc {
324
+ expect(nil).wont_equal_collection []
325
+ }.must_raise MiniTest::Assertion
326
+ err.message.must_match(/\bactual\b.*\bnil\b/)
327
+ end
328
+
329
+ end
330
+
331
+ describe "with `expect` nil" do
332
+
333
+ specify "raise" do
334
+ err = proc {
335
+ expect([]).wont_equal_collection nil
336
+ }.must_raise MiniTest::Assertion
337
+ err.message.must_match(/\bexpect\b.*\bnil\b/)
338
+ end
339
+
340
+ end
341
+
342
+ describe "with `actual` that does not respond to each" do
343
+
344
+ specify "raise" do
345
+ err = proc {
346
+ expect(Object.new).wont_equal_collection []
347
+ }.must_raise MiniTest::Assertion
348
+ err.message.must_match(/\bactual\b.*\brespond to each\b/)
349
+ end
350
+
351
+ end
352
+
353
+ describe "with `expect` that does not respond to each" do
354
+
355
+ specify "raise" do
356
+ err = proc {
357
+ expect([]).wont_equal_collection Object.new
358
+ }.must_raise MiniTest::Assertion
359
+ err.message.must_match(/\bexpect\b.*\brespond to each\b/)
360
+ end
361
+
362
+ end
363
+
364
+ end
365
+
366
+ end
367
+
368
+ end
369
+
370
+ end
metadata ADDED
@@ -0,0 +1,215 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sixarm_ruby_minitest_equal_collection
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.3.0
5
+ platform: ruby
6
+ authors:
7
+ - SixArm
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ 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
45
+ n+ES/gQPOnvmVkLDGw==
46
+ -----END CERTIFICATE-----
47
+ date: 2017-11-29 00:00:00.000000000 Z
48
+ dependencies:
49
+ - !ruby/object:Gem::Dependency
50
+ name: hashdiff
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 0.3.7
56
+ - - "<"
57
+ - !ruby/object:Gem::Version
58
+ version: '2'
59
+ type: :runtime
60
+ prerelease: false
61
+ version_requirements: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 0.3.7
66
+ - - "<"
67
+ - !ruby/object:Gem::Version
68
+ version: '2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 12.2.1
76
+ - - "<"
77
+ - !ruby/object:Gem::Version
78
+ version: '13'
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 12.2.1
86
+ - - "<"
87
+ - !ruby/object:Gem::Version
88
+ version: '13'
89
+ - !ruby/object:Gem::Dependency
90
+ name: minitest
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 5.10.3
96
+ - - "<"
97
+ - !ruby/object:Gem::Version
98
+ version: '6'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 5.10.3
106
+ - - "<"
107
+ - !ruby/object:Gem::Version
108
+ version: '6'
109
+ - !ruby/object:Gem::Dependency
110
+ name: yard
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 0.9.9
116
+ - - "<"
117
+ - !ruby/object:Gem::Version
118
+ version: '2'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: 0.9.9
126
+ - - "<"
127
+ - !ruby/object:Gem::Version
128
+ version: '2'
129
+ - !ruby/object:Gem::Dependency
130
+ name: simplecov
131
+ requirement: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: 0.14.1
136
+ - - "<"
137
+ - !ruby/object:Gem::Version
138
+ version: '2'
139
+ type: :development
140
+ prerelease: false
141
+ version_requirements: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: 0.14.1
146
+ - - "<"
147
+ - !ruby/object:Gem::Version
148
+ version: '2'
149
+ - !ruby/object:Gem::Dependency
150
+ name: coveralls
151
+ requirement: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: 0.8.21
156
+ - - "<"
157
+ - !ruby/object:Gem::Version
158
+ version: '2'
159
+ type: :development
160
+ prerelease: false
161
+ version_requirements: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: 0.8.21
166
+ - - "<"
167
+ - !ruby/object:Gem::Version
168
+ version: '2'
169
+ description: A Minitest assertion & expectation to compare two collections, such as
170
+ enumerations or arrays, in any order, and with output that shows the difference
171
+ email: sixarm@sixarm.com
172
+ executables: []
173
+ extensions: []
174
+ extra_rdoc_files: []
175
+ files:
176
+ - Rakefile
177
+ - lib/sixarm_ruby_minitest_equal_collection.rb
178
+ - lib/sixarm_ruby_minitest_equal_collection/minitest/assertions/equal_collection.rb
179
+ - lib/sixarm_ruby_minitest_equal_collection/minitest/expectations/equal_collection.rb
180
+ - test/sixarm_ruby_minitest_equal_collection_test.rb
181
+ - test/sixarm_ruby_minitest_equal_collection_test/minitest/assertions/equal_collection_test.rb
182
+ - test/sixarm_ruby_minitest_equal_collection_test/minitest/expectations/equal_collection_test.rb
183
+ homepage: http://sixarm.com/
184
+ licenses:
185
+ - Apache-2.0
186
+ - Artistic-2.0
187
+ - BSD-3-Clause
188
+ - GPL-3.0
189
+ - MIT
190
+ - MPL-2.0
191
+ metadata: {}
192
+ post_install_message:
193
+ rdoc_options: []
194
+ require_paths:
195
+ - lib
196
+ required_ruby_version: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ version: '0'
201
+ required_rubygems_version: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ requirements: []
207
+ rubyforge_project:
208
+ rubygems_version: 2.6.13
209
+ signing_key:
210
+ specification_version: 4
211
+ summary: SixArm.com → Ruby → Minitest → equal_collection assertion & extension
212
+ test_files:
213
+ - test/sixarm_ruby_minitest_equal_collection_test.rb
214
+ - test/sixarm_ruby_minitest_equal_collection_test/minitest/assertions/equal_collection_test.rb
215
+ - test/sixarm_ruby_minitest_equal_collection_test/minitest/expectations/equal_collection_test.rb
@@ -0,0 +1,2 @@
1
+ ͽn6k�s�ڐǽ��$h�P��H �z���v`J,C_H����m:5n�m�M�|�������$o`r)C(�������-��m���� ��8p��-��n������ ���O�޲uݪ!���D<F'�J\�H
2
+ de�ɐ�"x�x�'�s"5�0�U[���T��X �z-şU��7i(E�ã�8{#�"2D����Z]!{ n؛