amazing_print 1.6.0 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -2
  3. data/lib/amazing_print/ext/active_record.rb +32 -2
  4. data/lib/amazing_print/ext/nobrainer.rb +2 -2
  5. data/lib/amazing_print/formatters/base_formatter.rb +5 -1
  6. data/lib/amazing_print/formatters/hash_formatter.rb +29 -9
  7. data/lib/amazing_print/formatters/mswin_helper.rb +4 -4
  8. data/lib/amazing_print/formatters/object_formatter.rb +1 -1
  9. data/lib/amazing_print/formatters/struct_formatter.rb +1 -1
  10. data/lib/amazing_print/inspector.rb +1 -1
  11. data/lib/amazing_print/version.rb +1 -1
  12. metadata +6 -63
  13. data/.gitignore +0 -35
  14. data/Appraisals +0 -66
  15. data/Gemfile +0 -18
  16. data/Gemfile.lock +0 -94
  17. data/LICENSE +0 -22
  18. data/Rakefile +0 -25
  19. data/spec/active_record_helper.rb +0 -43
  20. data/spec/colors_spec.rb +0 -120
  21. data/spec/core_ext/logger_spec.rb +0 -70
  22. data/spec/ext/action_controller_spec.rb +0 -40
  23. data/spec/ext/action_view_spec.rb +0 -24
  24. data/spec/ext/active_model_spec.rb +0 -37
  25. data/spec/ext/active_record_spec.rb +0 -302
  26. data/spec/ext/active_support_spec.rb +0 -37
  27. data/spec/ext/mongo_mapper_spec.rb +0 -265
  28. data/spec/ext/mongoid_spec.rb +0 -135
  29. data/spec/ext/nobrainer_spec.rb +0 -64
  30. data/spec/ext/nokogiri_spec.rb +0 -52
  31. data/spec/ext/ostruct_spec.rb +0 -24
  32. data/spec/ext/ripple_spec.rb +0 -53
  33. data/spec/ext/sequel_spec.rb +0 -45
  34. data/spec/formats_spec.rb +0 -795
  35. data/spec/methods_spec.rb +0 -520
  36. data/spec/misc_spec.rb +0 -206
  37. data/spec/objects_spec.rb +0 -225
  38. data/spec/sequel_helper.rb +0 -18
  39. data/spec/spec_helper.rb +0 -112
  40. data/spec/support/active_record_data/3_2_diana.txt +0 -24
  41. data/spec/support/active_record_data/3_2_diana_legacy.txt +0 -24
  42. data/spec/support/active_record_data/3_2_multi.txt +0 -50
  43. data/spec/support/active_record_data/3_2_multi_legacy.txt +0 -50
  44. data/spec/support/active_record_data/4_0_diana.txt +0 -98
  45. data/spec/support/active_record_data/4_0_multi.txt +0 -198
  46. data/spec/support/active_record_data/4_1_diana.txt +0 -97
  47. data/spec/support/active_record_data/4_1_multi.txt +0 -196
  48. data/spec/support/active_record_data/4_2_diana.txt +0 -109
  49. data/spec/support/active_record_data/4_2_diana_legacy.txt +0 -109
  50. data/spec/support/active_record_data/4_2_multi.txt +0 -220
  51. data/spec/support/active_record_data/4_2_multi_legacy.txt +0 -220
  52. data/spec/support/active_record_data/5_0_diana.txt +0 -105
  53. data/spec/support/active_record_data/5_0_multi.txt +0 -212
  54. data/spec/support/active_record_data/5_1_diana.txt +0 -104
  55. data/spec/support/active_record_data/5_1_multi.txt +0 -210
  56. data/spec/support/active_record_data/5_2_diana.txt +0 -104
  57. data/spec/support/active_record_data/5_2_multi.txt +0 -210
  58. data/spec/support/active_record_data/6_0_diana.txt +0 -104
  59. data/spec/support/active_record_data/6_0_multi.txt +0 -210
  60. data/spec/support/active_record_data/6_1_diana.txt +0 -109
  61. data/spec/support/active_record_data/6_1_multi.txt +0 -220
  62. data/spec/support/active_record_data/7_0_diana.txt +0 -110
  63. data/spec/support/active_record_data/7_0_multi.txt +0 -222
  64. data/spec/support/active_record_data.rb +0 -22
  65. data/spec/support/ext_verifier.rb +0 -46
  66. data/spec/support/mongoid_versions.rb +0 -24
  67. data/spec/support/rails_versions.rb +0 -62
data/spec/methods_spec.rb DELETED
@@ -1,520 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # rubocop:disable Lint/ConstantDefinitionInBlock
4
-
5
- require 'spec_helper'
6
-
7
- RSpec.describe 'Single method' do
8
- after do
9
- Object.instance_eval { remove_const :Hello } if defined?(Hello)
10
- end
11
-
12
- it 'plain: should handle a method with no arguments' do
13
- method = ''.method(:upcase)
14
- if RUBY_VERSION >= '2.4.0'
15
- expect(method.ai(plain: true)).to eq('String#upcase(*arg1)')
16
- else
17
- expect(method.ai(plain: true)).to eq('String#upcase()')
18
- end
19
- end
20
-
21
- it 'color: should handle a method with no arguments' do
22
- method = ''.method(:upcase)
23
- if RUBY_VERSION >= '2.4.0'
24
- expect(method.ai).to eq("\e[1;33mString\e[0m#\e[0;35mupcase\e[0m\e[0;37m(*arg1)\e[0m")
25
- else
26
- expect(method.ai).to eq("\e[1;33mString\e[0m#\e[0;35mupcase\e[0m\e[0;37m()\e[0m")
27
- end
28
- end
29
-
30
- it 'plain: should handle a method with one argument' do
31
- method = ''.method(:include?)
32
- expect(method.ai(plain: true)).to eq('String#include?(arg1)')
33
- end
34
-
35
- it 'color: should handle a method with one argument' do
36
- method = ''.method(:include?)
37
- expect(method.ai).to eq("\e[1;33mString\e[0m#\e[0;35minclude?\e[0m\e[0;37m(arg1)\e[0m")
38
- end
39
-
40
- it 'plain: should handle a method with one required keyword argument' do
41
- class A
42
- def one(foo:); end
43
- end
44
- method = A.new.method(:one)
45
- expect(method.ai(plain: true)).to eq('A#one(foo:)')
46
- end
47
-
48
- it 'color: should handle a method with one required keyword argument' do
49
- class A
50
- def one(foo:); end
51
- end
52
- method = A.new.method(:one)
53
- expect(method.ai).to eq("\e[1;33mA\e[0m#\e[0;35mone\e[0m\e[0;37m(foo:)\e[0m")
54
- end
55
-
56
- it 'plain: should handle a method with one required and one optional keyword arguments' do
57
- class A
58
- def one(foo:, bar: 'baz'); end
59
- end
60
- method = A.new.method(:one)
61
- expect(method.ai(plain: true)).to eq('A#one(foo:, *bar:)')
62
- end
63
-
64
- it 'color: should handle a method with one required and one optional keyword arguments' do
65
- class A
66
- def one(foo:, bar: 'baz'); end
67
- end
68
- method = A.new.method(:one)
69
- expect(method.ai).to eq("\e[1;33mA\e[0m#\e[0;35mone\e[0m\e[0;37m(foo:, *bar:)\e[0m")
70
- end
71
-
72
- it 'plain: should handle a method with two arguments' do
73
- method = ''.method(:tr)
74
- expect(method.ai(plain: true)).to eq('String#tr(arg1, arg2)')
75
- end
76
-
77
- it 'color: should handle a method with two arguments' do
78
- method = ''.method(:tr)
79
- expect(method.ai).to eq("\e[1;33mString\e[0m#\e[0;35mtr\e[0m\e[0;37m(arg1, arg2)\e[0m")
80
- end
81
-
82
- it 'plain: should handle a method with multiple arguments' do
83
- method = ''.method(:split)
84
- expect(method.ai(plain: true)).to eq('String#split(*arg1)')
85
- end
86
-
87
- it 'color: should handle a method with multiple arguments' do
88
- method = ''.method(:split)
89
- expect(method.ai).to eq("\e[1;33mString\e[0m#\e[0;35msplit\e[0m\e[0;37m(*arg1)\e[0m")
90
- end
91
-
92
- it 'plain: should handle a method defined in mixin' do
93
- method = ''.method(:is_a?)
94
- expect(method.ai(plain: true)).to eq('String (Kernel)#is_a?(arg1)')
95
- end
96
-
97
- it 'color: should handle a method defined in mixin' do
98
- method = ''.method(:is_a?)
99
- expect(method.ai).to eq("\e[1;33mString (Kernel)\e[0m#\e[0;35mis_a?\e[0m\e[0;37m(arg1)\e[0m")
100
- end
101
-
102
- it 'plain: should handle an unbound method' do
103
- class Hello
104
- def world; end
105
- end
106
- method = Hello.instance_method(:world)
107
- expect(method.ai(plain: true)).to eq('Hello (unbound)#world()')
108
- end
109
-
110
- it 'color: should handle an unbound method' do
111
- class Hello
112
- def world(a, b); end
113
- end
114
- method = Hello.instance_method(:world)
115
- if RUBY_VERSION < '1.9.2'
116
- expect(method.ai).to eq("\e[1;33mHello (unbound)\e[0m#\e[0;35mworld\e[0m\e[0;37m(arg1, arg2)\e[0m")
117
- else
118
- expect(method.ai).to eq("\e[1;33mHello (unbound)\e[0m#\e[0;35mworld\e[0m\e[0;37m(a, b)\e[0m")
119
- end
120
- end
121
- end
122
-
123
- RSpec.describe 'Object methods' do
124
- after do
125
- Object.instance_eval { remove_const :Hello } if defined?(Hello)
126
- end
127
-
128
- describe 'object.methods' do
129
- it 'index: should handle object.methods' do
130
- out = nil.methods.ai(plain: true).split("\n").grep(/is_a\?/).first
131
- expect(out).to match(/^\s+\[\s*\d+\]\s+is_a\?\(arg1\)\s+NilClass \(Kernel\)$/)
132
- end
133
-
134
- it 'no index: should handle object.methods' do
135
- out = nil.methods.ai(plain: true, index: false).split("\n").grep(/is_a\?/).first
136
- expect(out).to match(/^\s+is_a\?\(arg1\)\s+NilClass \(Kernel\)$/)
137
- end
138
- end
139
-
140
- describe 'object.public_methods' do
141
- it 'index: should handle object.public_methods' do
142
- out = nil.public_methods.ai(plain: true).split("\n").grep(/is_a\?/).first
143
- expect(out).to match(/^\s+\[\s*\d+\]\s+is_a\?\(arg1\)\s+NilClass \(Kernel\)$/)
144
- end
145
-
146
- it 'no index: should handle object.public_methods' do
147
- out = nil.public_methods.ai(plain: true, index: false).split("\n").grep(/is_a\?/).first
148
- expect(out).to match(/^\s+is_a\?\(arg1\)\s+NilClass \(Kernel\)$/)
149
- end
150
- end
151
-
152
- describe 'object.private_methods' do
153
- it 'index: should handle object.private_methods' do
154
- out = nil.private_methods.ai(plain: true).split("\n").grep(/sleep/).first
155
- expect(out).to match(/^\s+\[\s*\d+\]\s+sleep\(\*arg1\)\s+NilClass \(Kernel\)$/)
156
- end
157
-
158
- it 'no index: should handle object.private_methods' do
159
- out = nil.private_methods.ai(plain: true, index: false).split("\n").grep(/sleep/).first
160
- expect(out).to match(/^\s+sleep\(\*arg1\)\s+NilClass \(Kernel\)$/)
161
- end
162
- end
163
-
164
- describe 'object.protected_methods' do
165
- it 'index: should handle object.protected_methods' do
166
- class Hello
167
- protected
168
-
169
- def m1; end
170
-
171
- def m2; end
172
- end
173
- expect(Hello.new.protected_methods.ai(plain: true)).to eq("[\n [0] m1() Hello\n [1] m2() Hello\n]")
174
- end
175
-
176
- it 'no index: should handle object.protected_methods' do
177
- class Hello
178
- protected
179
-
180
- def m3(a, b); end
181
- end
182
- if RUBY_VERSION < '1.9.2'
183
- expect(Hello.new.protected_methods.ai(plain: true, index: false)).to eq("[\n m3(arg1, arg2) Hello\n]")
184
- else
185
- expect(Hello.new.protected_methods.ai(plain: true, index: false)).to eq("[\n m3(a, b) Hello\n]")
186
- end
187
- end
188
- end
189
-
190
- describe 'object.private_methods' do
191
- it 'index: should handle object.private_methods' do
192
- class Hello
193
- private
194
-
195
- def m1; end
196
-
197
- def m2; end
198
- end
199
-
200
- out = Hello.new.private_methods.ai(plain: true).split("\n").grep(/m\d/)
201
- expect(out.first).to match(/^\s+\[\s*\d+\]\s+m1\(\)\s+Hello$/)
202
- expect(out.last).to match(/^\s+\[\s*\d+\]\s+m2\(\)\s+Hello$/)
203
- end
204
-
205
- it 'no index: should handle object.private_methods' do
206
- class Hello
207
- private
208
-
209
- def m3(a, b); end
210
- end
211
- out = Hello.new.private_methods.ai(plain: true).split("\n").grep(/m\d/)
212
- if RUBY_VERSION < '1.9.2'
213
- expect(out.first).to match(/^\s+\[\s*\d+\]\s+m3\(arg1, arg2\)\s+Hello$/)
214
- else
215
- expect(out.first).to match(/^\s+\[\s*\d+\]\s+m3\(a, b\)\s+Hello$/)
216
- end
217
- end
218
- end
219
-
220
- describe 'object.singleton_methods' do
221
- it 'index: should handle object.singleton_methods' do
222
- class Hello
223
- class << self
224
- def m1; end
225
-
226
- def m2; end
227
- end
228
- end
229
- out = Hello.singleton_methods.ai(plain: true).split("\n").grep(/m\d/)
230
- expect(out.first).to match(/^\s+\[\s*\d+\]\s+m1\(\)\s+Hello$/)
231
- expect(out.last).to match(/^\s+\[\s*\d+\]\s+m2\(\)\s+Hello$/)
232
- end
233
-
234
- it 'no index: should handle object.singleton_methods' do
235
- class Hello
236
- def self.m3(a, b); end
237
- end
238
- out = Hello.singleton_methods.ai(plain: true, index: false).split("\n").grep(/m\d/)
239
- if RUBY_VERSION < '1.9.2'
240
- expect(out.first).to match(/^\s+m3\(arg1, arg2\)\s+Hello$/)
241
- else
242
- expect(out.first).to match(/^\s+m3\(a, b\)\s+Hello$/)
243
- end
244
- end
245
- end
246
- end
247
-
248
- RSpec.describe 'Class methods' do
249
- after do
250
- Object.instance_eval { remove_const :Hello } if defined?(Hello)
251
- end
252
-
253
- describe 'class.instance_methods' do
254
- it 'index: should handle unbound class.instance_methods' do
255
- class Hello
256
- def m1; end
257
-
258
- def m2; end
259
- end
260
- out = Hello.instance_methods.ai(plain: true).split("\n").grep(/m\d/)
261
- expect(out.first).to match(/^\s+\[\s*\d+\]\s+m1\(\)\s+Hello\s\(unbound\)$/)
262
- expect(out.last).to match(/^\s+\[\s*\d+\]\s+m2\(\)\s+Hello\s\(unbound\)$/)
263
- end
264
-
265
- it 'no index: should handle unbound class.instance_methods' do
266
- class Hello
267
- def m3(a, b); end
268
- end
269
- out = Hello.instance_methods.ai(plain: true, index: false).split("\n").grep(/m\d/)
270
- if RUBY_VERSION < '1.9.2'
271
- expect(out.first).to match(/^\s+m3\(arg1, arg2\)\s+Hello\s\(unbound\)$/)
272
- else
273
- expect(out.first).to match(/^\s+m3\(a, b\)\s+Hello\s\(unbound\)$/)
274
- end
275
- end
276
- end
277
-
278
- describe 'class.public_instance_methods' do
279
- it 'index: should handle class.public_instance_methods' do
280
- class Hello
281
- def m1; end
282
-
283
- def m2; end
284
- end
285
- out = Hello.public_instance_methods.ai(plain: true).split("\n").grep(/m\d/)
286
- expect(out.first).to match(/^\s+\[\s*\d+\]\s+m1\(\)\s+Hello\s\(unbound\)$/)
287
- expect(out.last).to match(/^\s+\[\s*\d+\]\s+m2\(\)\s+Hello\s\(unbound\)$/)
288
- end
289
-
290
- it 'no index: should handle class.public_instance_methods' do
291
- class Hello
292
- def m3(a, b); end
293
- end
294
- out = Hello.public_instance_methods.ai(plain: true, index: false).split("\n").grep(/m\d/)
295
- if RUBY_VERSION < '1.9.2'
296
- expect(out.first).to match(/^\s+m3\(arg1, arg2\)\s+Hello\s\(unbound\)$/)
297
- else
298
- expect(out.first).to match(/^\s+m3\(a, b\)\s+Hello\s\(unbound\)$/)
299
- end
300
- end
301
- end
302
-
303
- describe 'class.protected_instance_methods' do
304
- it 'index: should handle class.protected_instance_methods' do
305
- class Hello
306
- protected
307
-
308
- def m1; end
309
-
310
- def m2; end
311
- end
312
- out = Hello.protected_instance_methods.ai(plain: true).split("\n").grep(/m\d/)
313
- expect(out.first).to match(/^\s+\[\s*\d+\]\s+m1\(\)\s+Hello\s\(unbound\)$/)
314
- expect(out.last).to match(/^\s+\[\s*\d+\]\s+m2\(\)\s+Hello\s\(unbound\)$/)
315
- end
316
-
317
- it 'no index: should handle class.protected_instance_methods' do
318
- class Hello
319
- protected
320
-
321
- def m3(a, b); end
322
- end
323
- out = Hello.protected_instance_methods.ai(plain: true, index: false).split("\n").grep(/m\d/)
324
- if RUBY_VERSION < '1.9.2'
325
- expect(out.first).to match(/^\s+m3\(arg1, arg2\)\s+Hello\s\(unbound\)$/)
326
- else
327
- expect(out.first).to match(/^\s+m3\(a, b\)\s+Hello\s\(unbound\)$/)
328
- end
329
- end
330
- end
331
-
332
- describe 'class.private_instance_methods' do
333
- it 'index: should handle class.private_instance_methods' do
334
- class Hello
335
- private
336
-
337
- def m1; end
338
-
339
- def m2; end
340
- end
341
- out = Hello.private_instance_methods.ai(plain: true).split("\n").grep(/m\d/)
342
- expect(out.first).to match(/^\s+\[\s*\d+\]\s+m1\(\)\s+Hello\s\(unbound\)$/)
343
- expect(out.last).to match(/^\s+\[\s*\d+\]\s+m2\(\)\s+Hello\s\(unbound\)$/)
344
- end
345
-
346
- it 'no index: should handle class.private_instance_methods' do
347
- class Hello
348
- private
349
-
350
- def m3(a, b); end
351
- end
352
- out = Hello.private_instance_methods.ai(plain: true, index: false).split("\n").grep(/m\d/)
353
- if RUBY_VERSION < '1.9.2'
354
- expect(out.first).to match(/^\s+m3\(arg1, arg2\)\s+Hello\s\(unbound\)$/)
355
- else
356
- expect(out.first).to match(/^\s+m3\(a, b\)\s+Hello\s\(unbound\)$/)
357
- end
358
- end
359
- end
360
- end
361
-
362
- if RUBY_VERSION >= '1.9.2'
363
- RSpec.describe 'Ruby 1.9.2+ Method#parameters' do
364
- before do
365
- stub_dotfile!
366
- end
367
-
368
- after do
369
- Object.instance_eval { remove_const :Hello } if defined?(Hello)
370
- end
371
-
372
- it '()' do
373
- class Hello
374
- def m1; end
375
- end
376
- out = Hello.new.methods.ai(plain: true).split("\n").grep(/m1/)
377
- expect(out.first).to match(/^\s+\[\s*\d+\]\s+m1\(\)\s+Hello$/)
378
- end
379
-
380
- it ':req' do
381
- class Hello
382
- def m1(a, b, c); end
383
- end
384
- out = Hello.new.methods.ai(plain: true).split("\n").grep(/m1/)
385
- expect(out.first).to match(/^\s+\[\s*\d+\]\s+m1\(a, b, c\)\s+Hello$/)
386
- end
387
-
388
- it ':opt' do
389
- class Hello
390
- # m1(a, *b, *c)
391
- def m1(a, b = 1, c = 2); end
392
- end
393
- out = Hello.new.methods.ai(plain: true).split("\n").grep(/m1/)
394
- expect(out.first).to match(/^\s+\[\s*\d+\]\s+m1\(a, \*b, \*c\)\s+Hello$/)
395
- end
396
-
397
- it ':rest' do
398
- class Hello
399
- # m1(*a)
400
- def m1(*a); end
401
- end
402
- out = Hello.new.methods.ai(plain: true).split("\n").grep(/m1/)
403
- expect(out.first).to match(/^\s+\[\s*\d+\]\s+m1\(\*a\)\s+Hello$/)
404
- end
405
-
406
- it ':block' do
407
- class Hello
408
- # m1(a, *b, &blk)
409
- def m1(a, b = nil, &blk); end
410
- end
411
- out = Hello.new.methods.ai(plain: true).split("\n").grep(/m1/)
412
- expect(out.first).to match(/^\s+\[\s*\d+\]\s+m1\(a, \*b, &blk\)\s+Hello$/)
413
- end
414
- end
415
- end
416
-
417
- RSpec.describe 'Methods arrays' do
418
- after do
419
- Object.instance_eval { remove_const :Hello } if defined?(Hello)
420
- Object.instance_eval { remove_const :World } if defined?(World)
421
- end
422
-
423
- it 'obj1.methods - obj2.methods should be awesome printed' do
424
- stub_dotfile!
425
- class Hello
426
- def self.m1; end
427
- end
428
- out = (Hello.methods - Class.methods).ai(plain: true)
429
- expect(out).to eq("[\n [0] m1() Hello\n]")
430
- end
431
-
432
- it 'obj1.methods & obj2.methods should be awesome printed' do
433
- stub_dotfile!
434
- class Hello
435
- def self.m1; end
436
-
437
- def self.m2; end
438
- end
439
-
440
- class World
441
- def self.m1; end
442
- end
443
- out = (Hello.methods & (World.methods - Class.methods)).ai(plain: true)
444
- expect(out).to eq("[\n [0] m1() Hello\n]")
445
- end
446
-
447
- it 'obj1.methods.grep(pattern) should be awesome printed' do
448
- stub_dotfile!
449
- class Hello
450
- def self.m1; end
451
-
452
- def self.m2; end
453
-
454
- def self.m3; end
455
- end
456
- out = Hello.methods.grep(/^m1$/).ai(plain: true)
457
- expect(out).to eq("[\n [0] m1() Hello\n]")
458
- out = Hello.methods.grep(/^m\d$/).ai(plain: true)
459
- expect(out).to eq("[\n [0] m1() Hello\n [1] m2() Hello\n [2] m3() Hello\n]")
460
- end
461
-
462
- it 'obj1.methods.grep(pattern, &block) should pass the matching string within the block' do
463
- class Hello
464
- def self.m_one; end
465
-
466
- def self.m_two; end
467
- end
468
-
469
- out = Hello.methods.sort.grep(/^m_(.+)$/) { Regexp.last_match(1).to_sym }
470
- expect(out).to eq(%i[one two])
471
- end
472
-
473
- it 'obj1.methods.grep(pattern, &block) should be awesome printed' do
474
- stub_dotfile!
475
- class Hello
476
- def self.m0; end
477
-
478
- def self.none; end
479
-
480
- def self.m1; end
481
-
482
- def self.one; end
483
- end
484
-
485
- out = Hello.methods.grep(/^m(\d)$/) { %w[none one][Regexp.last_match(1).to_i] }.ai(plain: true)
486
- expect(out).to eq("[\n [0] none() Hello\n [1] one() Hello\n]")
487
- end
488
-
489
- # See https://github.com/awesome-print/awesome_print/issues/30 for details.
490
- it 'grepping methods and converting them to_sym should work as expected' do
491
- class Hello
492
- private
493
-
494
- def him; end
495
-
496
- def his
497
- private_methods.grep(/^h..$/, &:to_sym)
498
- end
499
-
500
- def her
501
- private_methods.grep(/^.e.$/, &:to_sym)
502
- end
503
- end
504
-
505
- hello = Hello.new
506
- expect((hello.send(:his) - hello.send(:her)).sort_by(&:to_s)).to eq(%i[him his])
507
- end
508
-
509
- it 'appending garbage to methods array should not raise error' do
510
- arr = 42.methods << [:wtf]
511
- expect { arr.ai(plain: true) }.not_to raise_error
512
- if RUBY_VERSION < '1.9.2'
513
- expect(arr.ai(plain: true)).to match(/\s+wtf\(\?\)\s+\?/) # [ :wtf ].to_s => "wtf"
514
- else
515
- expect(arr.ai(plain: true)).to match(/\s+\[:wtf\]\(\?\)\s+\?/) # [ :wtf ].to_s => [:wtf]
516
- end
517
- end
518
- end
519
-
520
- # rubocop:enable Lint/ConstantDefinitionInBlock