duct_tape 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +10 -0
- data/Gemfile.lock +35 -0
- data/LICENSE +25 -0
- data/README.md +223 -0
- data/Rakefile +38 -0
- data/VERSION +1 -0
- data/duct_tape.gemspec +106 -0
- data/ext/mkrf_conf.rb +36 -0
- data/git_hooks/env_vars.sh +287 -0
- data/git_hooks/post-commit +43 -0
- data/git_hooks/post-merge +8 -0
- data/git_hooks/pre-commit +273 -0
- data/install_git_hooks +17 -0
- data/lib/algorithms/containers/heap.rb +15 -0
- data/lib/algorithms/containers/priority_queue.rb +11 -0
- data/lib/algorithms/containers.rb +1 -0
- data/lib/duct_tape/autoassociative_array.rb +110 -0
- data/lib/duct_tape.rb +10 -0
- data/lib/ext/array.rb +327 -0
- data/lib/ext/boolean.rb +3 -0
- data/lib/ext/datetime.rb +7 -0
- data/lib/ext/dir.rb +59 -0
- data/lib/ext/file.rb +40 -0
- data/lib/ext/hash.rb +83 -0
- data/lib/ext/kernel.rb +593 -0
- data/lib/ext/numeric.rb +74 -0
- data/lib/ext/object.rb +17 -0
- data/lib/ext/pathname.rb +114 -0
- data/lib/ext/range.rb +7 -0
- data/lib/ext/regexp.rb +12 -0
- data/lib/ext/string.rb +54 -0
- data/lib/ext/symbol.rb +8 -0
- data/lib/ext/time.rb +32 -0
- data/lib/ext/uri.rb +16 -0
- data/spec/algorithms/containers/heap_spec.rb +19 -0
- data/spec/algorithms/containers/priority_queue_spec.rb +19 -0
- data/spec/duct_tape/autoassociative_array_spec.rb +139 -0
- data/spec/ext/array_spec.rb +407 -0
- data/spec/ext/boolean_spec.rb +19 -0
- data/spec/ext/datetime_spec.rb +10 -0
- data/spec/ext/dir_spec.rb +46 -0
- data/spec/ext/file_spec.rb +10 -0
- data/spec/ext/hash_spec.rb +73 -0
- data/spec/ext/kernel_spec.rb +64 -0
- data/spec/ext/numeric_spec.rb +61 -0
- data/spec/ext/object_spec.rb +19 -0
- data/spec/ext/pathname_spec.rb +13 -0
- data/spec/ext/range_spec.rb +10 -0
- data/spec/ext/regexp_spec.rb +10 -0
- data/spec/ext/string_spec.rb +73 -0
- data/spec/ext/symbol_spec.rb +10 -0
- data/spec/ext/time_spec.rb +19 -0
- data/spec/ext/uri_spec.rb +28 -0
- data/spec/spec_helper.rb +7 -0
- metadata +183 -0
@@ -0,0 +1,407 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
|
2
|
+
|
3
|
+
#
|
4
|
+
# Array#deep_merge
|
5
|
+
#
|
6
|
+
describe Array, "#deep_merge" do
|
7
|
+
it "remains unchanged" do
|
8
|
+
ary = [1,2,3,4,5]
|
9
|
+
ary.deep_merge([6,7,8])
|
10
|
+
ary.should eq([1,2,3,4,5])
|
11
|
+
end
|
12
|
+
|
13
|
+
it "merges flat arrays properly" do
|
14
|
+
ary = [1,2,3,4,5]
|
15
|
+
val = ary.deep_merge([4,5,6])
|
16
|
+
val.should eq([1,2,3,4,5,6])
|
17
|
+
(val.__id__ == ary.__id__).should be_false
|
18
|
+
end
|
19
|
+
|
20
|
+
it "merges nested arrays properly" do
|
21
|
+
ary = [1,2,[3,4,5]]
|
22
|
+
val = ary.deep_merge([3,4,[5,6,7]])
|
23
|
+
val.should eq([1,2,[3,4,5,6,7],3,4])
|
24
|
+
(val.__id__ == ary.__id__).should be_false
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# Array#deep_merge!
|
30
|
+
#
|
31
|
+
describe Array, "#deep_merge!" do
|
32
|
+
it "changes" do
|
33
|
+
ary = [1,2,3,4,5]
|
34
|
+
val = ary.deep_merge!([6,7,8])
|
35
|
+
ary.should eq([1,2,3,4,5,6,7,8])
|
36
|
+
(val.__id__ == ary.__id__).should be_true
|
37
|
+
end
|
38
|
+
|
39
|
+
it "returns nil if nothing was changed" do
|
40
|
+
ary = [1,2,3,4,5]
|
41
|
+
val = ary.deep_merge!([4,5])
|
42
|
+
val.should be_nil
|
43
|
+
end
|
44
|
+
|
45
|
+
it "returns self if it changed" do
|
46
|
+
ary = [1,2,3,4,5]
|
47
|
+
val = ary.deep_merge!([4,5,6])
|
48
|
+
val.should eq([1,2,3,4,5,6])
|
49
|
+
(val.__id__ == ary.__id__).should be_true
|
50
|
+
end
|
51
|
+
|
52
|
+
it "merges flat arrays properly" do
|
53
|
+
ary = [1,2,3,4,5]
|
54
|
+
ary.deep_merge!([4,5,6])
|
55
|
+
ary.should eq([1,2,3,4,5,6])
|
56
|
+
end
|
57
|
+
|
58
|
+
it "merges nested arrays properly" do
|
59
|
+
ary = [1,2,[3,4,5]]
|
60
|
+
ary.deep_merge!([3,4,[5,6,7]])
|
61
|
+
ary.should eq([1,2,[3,4,5,6,7],3,4])
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
#
|
66
|
+
# Array#*
|
67
|
+
#
|
68
|
+
describe Array, "#*" do
|
69
|
+
it "remains unchanged" do
|
70
|
+
ary = [1,2,3]
|
71
|
+
val1 = ary * 2; val2 = ary * ","; val3 = ary * ary
|
72
|
+
ary.should eq([1,2,3])
|
73
|
+
(val1.__id__ == ary.__id__).should be_false
|
74
|
+
(val2.__id__ == ary.__id__).should be_false
|
75
|
+
(val3.__id__ == ary.__id__).should be_false
|
76
|
+
end
|
77
|
+
|
78
|
+
it "concats correctly" do
|
79
|
+
ary = [1,2,3]
|
80
|
+
|
81
|
+
(ary * 0).should eq([])
|
82
|
+
(ary * 1).should eq([1,2,3])
|
83
|
+
(ary * 2).should eq([1,2,3,1,2,3])
|
84
|
+
end
|
85
|
+
|
86
|
+
it "joins correctly" do
|
87
|
+
ary = [1,2,3]
|
88
|
+
|
89
|
+
(ary * "").should eq("123")
|
90
|
+
(ary * ",").should eq("1,2,3")
|
91
|
+
end
|
92
|
+
|
93
|
+
it "cross-multiplies correctly" do
|
94
|
+
ary = [0,1]
|
95
|
+
|
96
|
+
(ary * []).should eq([])
|
97
|
+
(ary * [0]).should eq([[0,0],[1,0]])
|
98
|
+
(ary * ary).should eq([[0,0],[0,1],[1,0],[1,1]])
|
99
|
+
(ary * [0,1,2]).should eq([[0,0],[0,1],[0,2],[1,0],[1,1],[1,2]])
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
#
|
104
|
+
# Array#**
|
105
|
+
#
|
106
|
+
describe Array, "#**" do
|
107
|
+
it "remains unchanged" do
|
108
|
+
ary = [0,1]
|
109
|
+
val = ary ** 2
|
110
|
+
ary.should eq([0,1])
|
111
|
+
(val.__id__ == ary.__id__).should be_false
|
112
|
+
end
|
113
|
+
|
114
|
+
it "multiplies correctly" do
|
115
|
+
ary = [0,1]
|
116
|
+
(ary ** -1).should eq([])
|
117
|
+
(ary ** 0).should eq([])
|
118
|
+
(ary ** 1).should eq([[0],[1]])
|
119
|
+
(ary ** 2).should eq([[0,0],[0,1],[1,0],[1,1]])
|
120
|
+
(ary ** 3).should eq([[0,0,0],[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1]])
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
#
|
125
|
+
# Array#uniq_by
|
126
|
+
#
|
127
|
+
describe Array, "#uniq_by" do
|
128
|
+
it "remains unchanged" do
|
129
|
+
ary = [0,0]
|
130
|
+
val = ary.uniq_by { |i| i }
|
131
|
+
ary.should eq([0,0])
|
132
|
+
(val.__id__ == ary.__id__).should be_false
|
133
|
+
end
|
134
|
+
|
135
|
+
it "filters by the return value of the block" do
|
136
|
+
ary = [0,1]
|
137
|
+
val = ary.uniq_by { |i| true }
|
138
|
+
val.should eq([0])
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
#
|
143
|
+
# Array#unanimous?
|
144
|
+
#
|
145
|
+
describe Array, "#unanimous?" do
|
146
|
+
it "remains unchanged" do
|
147
|
+
ary = [0,0]
|
148
|
+
val = ary.unanimous?
|
149
|
+
ary.should eq([0,0])
|
150
|
+
(val.__id__ == ary.__id__).should be_false
|
151
|
+
end
|
152
|
+
|
153
|
+
it "returns true and false with no argument and no block" do
|
154
|
+
[0,0].unanimous?.should be_true
|
155
|
+
[0,1].unanimous?.should be_false
|
156
|
+
end
|
157
|
+
|
158
|
+
it "returns true and false with an argument and no block" do
|
159
|
+
[0,0].unanimous?(0).should be_true
|
160
|
+
[0,0].unanimous?(1).should be_false
|
161
|
+
end
|
162
|
+
|
163
|
+
it "returns true and false with no argument and with a block" do
|
164
|
+
[0,0].unanimous? { |i| i == 1 }.should be_true
|
165
|
+
[0,1].unanimous? { |i| i == 1 }.should be_false
|
166
|
+
end
|
167
|
+
|
168
|
+
it "returns true and false with an argument and a block" do
|
169
|
+
[0,0].unanimous?(false) { |i| i.odd? }.should be_true
|
170
|
+
[0,0].unanimous?(true) { |i| i.odd? }.should be_false
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
#
|
175
|
+
# Array#to_h
|
176
|
+
#
|
177
|
+
describe Array, "#to_h" do
|
178
|
+
it "remains unchanged" do
|
179
|
+
ary = [0,0]
|
180
|
+
val = ary.to_h
|
181
|
+
ary.should eq([0,0])
|
182
|
+
(val.__id__ == ary.__id__).should be_false
|
183
|
+
end
|
184
|
+
|
185
|
+
it "converts flat arrays" do
|
186
|
+
%w{a b c}.to_h.should eq({0=>"a", 1=>"b", 2=>"c"})
|
187
|
+
%w{a b}.to_h.should eq({0=>"a", 1=>"b"})
|
188
|
+
['a'].to_h.should eq({0=>"a"})
|
189
|
+
[].to_h.should eq({})
|
190
|
+
end
|
191
|
+
|
192
|
+
it "converts an array of pairs" do
|
193
|
+
[[1,2], [3,4]].to_h.should eq({1=>2, 3=>4})
|
194
|
+
[[1,2]].to_h.should eq({1=>2})
|
195
|
+
end
|
196
|
+
|
197
|
+
it "converts an array of hashes (without conflicts)" do
|
198
|
+
[{1=>2}, {3=>4}].to_h.should eq({1=>2, 3=>4})
|
199
|
+
[{1=>2}].to_h.should eq({1=>2})
|
200
|
+
end
|
201
|
+
|
202
|
+
it "converts an array of hashes (with conflicts)" do
|
203
|
+
[{1=>2}, {3=>4, 1=>5}].to_h.should eq({1=>[2,5], 3=>4})
|
204
|
+
[{1=>2}].to_h.should eq({1=>2})
|
205
|
+
end
|
206
|
+
|
207
|
+
it "converts an array of hashes with common name and value keys" do
|
208
|
+
ary = [{"name" => 1, "value" => 2}, {"name" => 3, "value" => 4}]
|
209
|
+
ary.to_h.should eq({1=>2, 3=>4})
|
210
|
+
|
211
|
+
ary = [{:name => 1, :value => 2}, {:name => 3, :value => 4}]
|
212
|
+
ary.to_h.should eq({1=>2, 3=>4})
|
213
|
+
|
214
|
+
ary = [{:x => 1, :y => 2}, {:x => 3, :y => 4}]
|
215
|
+
ary.to_h(:x, :y).should eq({1=>2, 3=>4})
|
216
|
+
|
217
|
+
ary = [{:x => 1, :y => 2}, {:x => 3, :y => 4}]
|
218
|
+
ary.to_h("x", "y").should eq({1=>2, 3=>4})
|
219
|
+
end
|
220
|
+
|
221
|
+
it "converts a hash-turned-array back to the original hash" do
|
222
|
+
hsh = {1=>{2=>3}}
|
223
|
+
val = hsh.to_a.to_h
|
224
|
+
hsh.should eq(val)
|
225
|
+
(val.__id__ == hsh.__id__).should be_false
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
#
|
230
|
+
# Array#map_to_h
|
231
|
+
#
|
232
|
+
describe Array, "#map_to_h" do
|
233
|
+
it "remains unchanged" do
|
234
|
+
# TODO
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
#
|
239
|
+
# Array#chunk
|
240
|
+
#
|
241
|
+
describe Array, "#chunk" do
|
242
|
+
it "remains unchanged" do
|
243
|
+
# TODO
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
#
|
248
|
+
# Array#not_empty?
|
249
|
+
#
|
250
|
+
describe Array, "#not_empty?" do
|
251
|
+
it "remains unchanged" do
|
252
|
+
# TODO
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
#
|
257
|
+
# Array#sum
|
258
|
+
#
|
259
|
+
describe Array, "#sum" do
|
260
|
+
it "remains unchanged" do
|
261
|
+
# TODO
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
#
|
266
|
+
# Array#product
|
267
|
+
#
|
268
|
+
describe Array, "#product" do
|
269
|
+
it "remains unchanged" do
|
270
|
+
# TODO
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
#
|
275
|
+
# Array#squares
|
276
|
+
#
|
277
|
+
describe Array, "#squares" do
|
278
|
+
it "remains unchanged" do
|
279
|
+
# TODO
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
#
|
284
|
+
# Array#ranks
|
285
|
+
#
|
286
|
+
describe Array, "#ranks" do
|
287
|
+
it "remains unchanged" do
|
288
|
+
# TODO
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
#
|
293
|
+
# Array#sqrts
|
294
|
+
#
|
295
|
+
describe Array, "#sqrts" do
|
296
|
+
it "remains unchanged" do
|
297
|
+
# TODO
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
#
|
302
|
+
# Array#mean
|
303
|
+
#
|
304
|
+
describe Array, "#mean" do
|
305
|
+
it "remains unchanged" do
|
306
|
+
# TODO
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
#
|
311
|
+
# Array#frequencies
|
312
|
+
#
|
313
|
+
describe Array, "#frequencies" do
|
314
|
+
it "remains unchanged" do
|
315
|
+
# TODO
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
#
|
320
|
+
# Array#variance
|
321
|
+
#
|
322
|
+
describe Array, "#variance" do
|
323
|
+
it "remains unchanged" do
|
324
|
+
# TODO
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
#
|
329
|
+
# Array#std_dev
|
330
|
+
#
|
331
|
+
describe Array, "#std_dev" do
|
332
|
+
it "remains unchanged" do
|
333
|
+
# TODO
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
#
|
338
|
+
# Array#median
|
339
|
+
#
|
340
|
+
describe Array, "#median" do
|
341
|
+
it "remains unchanged" do
|
342
|
+
# TODO
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
#
|
347
|
+
# Array#first_quartile
|
348
|
+
#
|
349
|
+
describe Array, "#first_quartile" do
|
350
|
+
it "remains unchanged" do
|
351
|
+
# TODO
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
#
|
356
|
+
# Array#last_quartile
|
357
|
+
#
|
358
|
+
describe Array, "#last_quartile" do
|
359
|
+
it "remains unchanged" do
|
360
|
+
# TODO
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
#
|
365
|
+
# Array#quartiles
|
366
|
+
#
|
367
|
+
describe Array, "#quartiles" do
|
368
|
+
it "remains unchanged" do
|
369
|
+
# TODO
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
373
|
+
#
|
374
|
+
# Array#interquartile_range
|
375
|
+
#
|
376
|
+
describe Array, "#interquartile_range" do
|
377
|
+
it "remains unchanged" do
|
378
|
+
# TODO
|
379
|
+
end
|
380
|
+
end
|
381
|
+
|
382
|
+
#
|
383
|
+
# Array#modes
|
384
|
+
#
|
385
|
+
describe Array, "#modes" do
|
386
|
+
it "remains unchanged" do
|
387
|
+
# TODO
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
#
|
392
|
+
# Array#midrange
|
393
|
+
#
|
394
|
+
describe Array, "#midrange" do
|
395
|
+
it "remains unchanged" do
|
396
|
+
# TODO
|
397
|
+
end
|
398
|
+
end
|
399
|
+
|
400
|
+
#
|
401
|
+
# Array#statistical_range
|
402
|
+
#
|
403
|
+
describe Array, "#statistical_range" do
|
404
|
+
it "remains unchanged" do
|
405
|
+
# TODO
|
406
|
+
end
|
407
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
|
2
|
+
|
3
|
+
#
|
4
|
+
# TrueClass#is_a? Boolean
|
5
|
+
#
|
6
|
+
describe TrueClass, "#is_a? Boolean" do
|
7
|
+
it "is a Boolean" do
|
8
|
+
true.should be_a_kind_of Boolean
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
#
|
13
|
+
# FalseClass#is_a? Boolean
|
14
|
+
#
|
15
|
+
describe FalseClass, "#is_a? Boolean" do
|
16
|
+
it "is a Boolean" do
|
17
|
+
false.should be_a_kind_of Boolean
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
|
2
|
+
|
3
|
+
#
|
4
|
+
# Dir.relative_path
|
5
|
+
#
|
6
|
+
describe Dir, ".relative_path" do
|
7
|
+
it "remains unchanged" do
|
8
|
+
# TODO
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
#
|
13
|
+
# Dir.absolute_path
|
14
|
+
#
|
15
|
+
describe Dir, ".absolute_path" do
|
16
|
+
it "remains unchanged" do
|
17
|
+
# TODO
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# Dir.empty?
|
23
|
+
#
|
24
|
+
describe Dir, ".empty?" do
|
25
|
+
it "remains unchanged" do
|
26
|
+
# TODO
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# Dir#children
|
32
|
+
#
|
33
|
+
describe Dir, "#children" do
|
34
|
+
it "remains unchanged" do
|
35
|
+
# TODO
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
#
|
40
|
+
# Dir#/
|
41
|
+
#
|
42
|
+
describe Dir, "#/" do
|
43
|
+
it "remains unchanged" do
|
44
|
+
# TODO
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
|
2
|
+
|
3
|
+
#
|
4
|
+
# Hash#deep_merge
|
5
|
+
#
|
6
|
+
describe Hash, "#deep_merge" do
|
7
|
+
it "remains unchanged" do
|
8
|
+
# TODO
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
#
|
13
|
+
# Hash#deep_merge!
|
14
|
+
#
|
15
|
+
describe Hash, "#deep_merge!" do
|
16
|
+
it "changes" do
|
17
|
+
# TODO
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# Hash#chunk
|
23
|
+
#
|
24
|
+
describe Hash, "#chunk" do
|
25
|
+
it "remains unchanged" do
|
26
|
+
# TODO
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# Hash#not_empty?
|
32
|
+
#
|
33
|
+
describe Hash, "#not_empty?" do
|
34
|
+
it "remains unchanged" do
|
35
|
+
# TODO
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
#
|
40
|
+
# Hash#select_keys
|
41
|
+
#
|
42
|
+
describe Hash, "#select_keys" do
|
43
|
+
it "remains unchanged" do
|
44
|
+
# TODO
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# Hash#select_keys!
|
50
|
+
#
|
51
|
+
describe Hash, "#select_keys!" do
|
52
|
+
it "changes" do
|
53
|
+
# TODO
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
#
|
58
|
+
# Hash#reject_keys
|
59
|
+
#
|
60
|
+
describe Hash, "#reject_keys" do
|
61
|
+
it "remains unchanged" do
|
62
|
+
# TODO
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# Hash#reject_keys!
|
68
|
+
#
|
69
|
+
describe Hash, "#reject_keys!" do
|
70
|
+
it "changes" do
|
71
|
+
# TODO
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
|
2
|
+
|
3
|
+
#
|
4
|
+
# Kernel#this_method
|
5
|
+
#
|
6
|
+
describe Kernel, "#this_method" do
|
7
|
+
it "remains unchanged" do
|
8
|
+
# TODO
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
#
|
13
|
+
# Kernel#calling_method
|
14
|
+
#
|
15
|
+
describe Kernel, "#calling_method" do
|
16
|
+
it "remains unchanged" do
|
17
|
+
# TODO
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# Kernel#tty?
|
23
|
+
#
|
24
|
+
describe Kernel, "#tty?" do
|
25
|
+
it "remains unchanged" do
|
26
|
+
# TODO
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# Kernel#tty_width
|
32
|
+
#
|
33
|
+
describe Kernel, "#tty_width" do
|
34
|
+
it "remains unchanged" do
|
35
|
+
# TODO
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
#
|
40
|
+
# Kernel#not_implemented
|
41
|
+
#
|
42
|
+
describe Kernel, "#not_implemented" do
|
43
|
+
it "remains unchanged" do
|
44
|
+
# TODO
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# Kernel#automatic_require
|
50
|
+
#
|
51
|
+
describe Kernel, "#automatic_require" do
|
52
|
+
it "remains unchanged" do
|
53
|
+
# TODO
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
#
|
58
|
+
# Kernel#type_assert
|
59
|
+
#
|
60
|
+
describe Kernel, "#type_assert" do
|
61
|
+
it "remains unchanged" do
|
62
|
+
# TODO
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
|
2
|
+
|
3
|
+
#
|
4
|
+
# Numeric#units
|
5
|
+
#
|
6
|
+
describe Numeric, "units" do
|
7
|
+
it "chronological sizes" do
|
8
|
+
3.years.should eq(3*365*24*60*60)
|
9
|
+
3.weeks.should eq(3*7*24*60*60)
|
10
|
+
3.days.should eq(3*24*60*60)
|
11
|
+
3.hours.should eq(3*60*60)
|
12
|
+
3.minutes.should eq(3*60)
|
13
|
+
3.mseconds.should eq(3 / 1000.0)
|
14
|
+
3.useconds.should eq(3 / 1000000.0)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "byte sizes" do
|
18
|
+
3.eb.should eq(3*(2**60))
|
19
|
+
3.pb.should eq(3*(2**50))
|
20
|
+
3.tb.should eq(3*(2**40))
|
21
|
+
3.gb.should eq(3*(2**30))
|
22
|
+
3.mb.should eq(3*(2**20))
|
23
|
+
3.kb.should eq(3*(2**10))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# Numeric#to_degrees
|
29
|
+
#
|
30
|
+
describe Numeric, "#to_degrees" do
|
31
|
+
it "remains unchanged" do
|
32
|
+
# TODO
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# Numeric#to_radians
|
38
|
+
#
|
39
|
+
describe Numeric, "#to_radians" do
|
40
|
+
it "remains unchanged" do
|
41
|
+
# TODO
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
#
|
46
|
+
# Numeric#rank
|
47
|
+
#
|
48
|
+
describe Numeric, "#rank" do
|
49
|
+
it "remains unchanged" do
|
50
|
+
# TODO
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
#
|
55
|
+
# Numeric#percentage_of
|
56
|
+
#
|
57
|
+
describe Numeric, "#percentage_of" do
|
58
|
+
it "remains unchanged" do
|
59
|
+
# TODO
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
|
2
|
+
|
3
|
+
#
|
4
|
+
# Object#deep_dup
|
5
|
+
#
|
6
|
+
describe Object, "#deep_dup" do
|
7
|
+
it "remains unchanged" do
|
8
|
+
# TODO
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
#
|
13
|
+
# Object#just_my_methods
|
14
|
+
#
|
15
|
+
describe Object, "#just_my_methods" do
|
16
|
+
it "remains unchanged" do
|
17
|
+
# TODO
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
|
2
|
+
|
3
|
+
#
|
4
|
+
# Pathname.which
|
5
|
+
#
|
6
|
+
describe Pathname, ".which" do
|
7
|
+
it "finds executables correctly" do
|
8
|
+
%w{which}.each do |cmd|
|
9
|
+
pname = Pathname.which(cmd)
|
10
|
+
pname.to_s.should eq(`which #{cmd}`.chomp)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|