spec/humanize_bytes/byte_spec.rb in humanize-bytes-0.1.0 vs spec/humanize_bytes/byte_spec.rb in humanize-bytes-1.0.0
- old
+ new
@@ -8,29 +8,38 @@
b.value.should == 2147843648
end
end
context "#to_b" do
- it "should return the value" do
- b.to_b.should == 2147843648
+ it "should return return self" do
+ b.to_b.should be b
end
end
context "#to_k" do
- it "should convert the value to kilo bytes" do
- b.to_k.should == 2097503.5625
+ it "should convert to Kilo bytes" do
+ b.to_k.class.should be Kilo
end
+ it "should convert the value to Kilo bytes" do
+ b.to_k.value.should == 2097503.5625
+ end
end
context "#to_m" do
- it "should convert the value to mega bytes" do
- b.to_m.should == 2048.3433227539062
+ it "should convert to Mega bytes" do
+ b.to_m.class.should be Mega
end
+ it "should convert the value to Mega bytes" do
+ b.to_m.value.should == 2048.3433227539062
+ end
end
context "#to_g" do
- it "should convert the value to giga bytes" do
- b.to_g.should == 2.0003352761268616
+ it "should convert to Giga bytes" do
+ b.to_g.class.should be Giga
+ end
+ it "should convert the value to Giga bytes" do
+ b.to_g.value.should == 2.0003352761268616
end
end
context "#to_s" do
context "when value is an integer" do
\ No newline at end of file