akitaonrails / utility-belt forked from gilesbowkett/utility-belt

IRB Power User Utility Belt

utility-belt / spec / array_numberings_spec.rb
100644 38 lines (28 sloc) 0.692 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require File.join(File.dirname(__FILE__), "spec_helper")
require "lib/utility_belt/array_numberings"
describe "Array Numberings" do
 
before do
@the_methods = {
:second => 1,
:third => 2,
:fourth => 3,
:fifth => 4,
:sixth => 5,
:seventh => 6,
:eighth => 7,
:ninth => 8,
:tenth => 9
}
end
 
  it "should add array numberings" do
 
@the_methods.keys do | method_name |
Array.new.respond_to?(method_name).should == true
end
 
  end
 
it "should return the right value from each numbering" do
 
array = (0..10).to_a
 
@the_methods.each_pair do | method_name, index |
array.send(method_name).should == array[index]
end
 
end
 
end