spec/quantity_spec.rb in quantify-1.1.0 vs spec/quantity_spec.rb in quantify-1.2.0

- old
+ new

@@ -152,11 +152,11 @@ time_in_hours = time_in_min.to_hours speed = distance_in_miles / time_in_hours speed.class.should == Quantity speed.value.should be_close 27.1143792976291, 0.00000001 speed.to_s(:name).should == "27.1143792976291 miles per hour" - speed.to_s.should == "27.1143792976291 mi h^-1" + speed.to_s.should == "27.1143792976291 mi/h" end it "coerce method should handle inverted syntax" do quantity = 1/2.ft quantity.to_s.should == "0.5 ft^-1" @@ -183,11 +183,11 @@ 13.1.stones.to_kg.to_s(:name).should == "83.1888383 kilograms" end it "should convert compound units correctly" do speed = Quantity.new 100, (Unit.km/Unit.h) - speed.to_mi.round(2).to_s.should == "62.14 mi h^-1" + speed.to_mi.round(2).to_s.should == "62.14 mi/h" end it "should convert to SI unit correctly" do 100.cm.to_si.to_s.should == "1.0 m" 2.kWh.to_si.to_s.should == "7200000.0 J" @@ -222,21 +222,21 @@ unit = 50.ft ** 3 unit.to_s.should == "125000.0 ft³" unit = 50.ft ** -1 unit.to_s.should == "0.02 ft^-1" unit = (10.m/1.s)**2 - unit.to_s.should == "100.0 m² s^-2" + unit.to_s.should == "100.0 m²/s²" unit = (10.m/1.s)**-1 - unit.to_s.should == "0.1 s m^-1" + unit.to_s.should == "0.1 s/m" lambda{ ((10.m/1.s)** 0.5) }.should raise_error end it "should raise a quantity to a power correctly" do (50.ft.pow! 2).to_s.should == "2500.0 ft²" (50.ft.pow! 3).to_s.should == "125000.0 ft³" (50.ft.pow! -1).to_s.should == "0.02 ft^-1" - ((10.m/1.s).pow! 2).to_s.should == "100.0 m² s^-2" - ((10.m/1.s).pow! -1).to_s.should == "0.1 s m^-1" + ((10.m/1.s).pow! 2).to_s.should == "100.0 m²/s²" + ((10.m/1.s).pow! -1).to_s.should == "0.1 s/m" lambda{ ((10.m/1.s).pow! 0.5) }.should raise_error end it "should parse using string method" do "20 m".to_q.value.should == 20.0