spec/humanize/mega_spec.rb in humanize-bytes-2.1.0 vs spec/humanize/mega_spec.rb in humanize-bytes-2.2.0

- old
+ new

@@ -46,9 +46,59 @@ it "should convert the value to Giga bytes" do expect(m.to_g.value).to eq(0.00476837158203125) end end + context "#to_t" do + it "should convert to Tera bytes" do + expect(m.to_t).to be_an_instance_of(Humanize::Tera) + end + + it "should convert the value to Tera bytes" do + expect(m.to_t.value).to eq(0.000004656612873077393) + end + end + + context "#to_p" do + it "should convert to Peta bytes" do + expect(m.to_p).to be_an_instance_of(Humanize::Peta) + end + + it "should convert the value to Peta bytes" do + expect(m.to_p.value).to eq(0.000000004547473508864641) + end + end + + context "#to_e" do + it "should convert to Exa bytes" do + expect(m.to_e).to be_an_instance_of(Humanize::Exa) + end + + it "should convert the value to Exa bytes" do + expect(m.to_e.value).to eq(0.000000000004440892098500626) + end + end + + context "#to_z" do + it "should convert to Zetta bytes" do + expect(m.to_z).to be_an_instance_of(Humanize::Zetta) + end + + it "should convert the value to Zetta bytes" do + expect(m.to_z.value).to eq(0.000000000000004336808689942018) + end + end + + context "#to_y" do + it "should convert to Yotta bytes" do + expect(m.to_y).to be_an_instance_of(Humanize::Yotta) + end + + it "should convert the value to Yotta bytes" do + expect(m.to_y.value).to eq(4.235164736271502e-18) + end + end + context "#to_s" do context 'without any specification' do it "should return a float with all digits" do expect(m.to_s).to eq('4.8828125') end \ No newline at end of file