spec/fixnum_spec.rb in brightbox-rujitsu-0.1.8 vs spec/fixnum_spec.rb in brightbox-rujitsu-0.1.9
- old
+ new
@@ -101,9 +101,23 @@
i.should >= 4
i.should <= 6
end
end
+ it "should create an even number" do
+ num = 5.random_numbers(:only => :even)
+
+ num.should be_a_kind_of(String)
+ (num.to_i % 2).should == 0
+ end
+
+ it "should create an odd number" do
+ num = 5.random_numbers(:only => :odd)
+
+ num.should be_a_kind_of(String)
+ (num.to_i % 2).should_not == 0
+ end
+
private
def string_to_integers(str)
str.split("").map {|x| x.to_i }
end