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

- old
+ new

@@ -189,11 +189,11 @@ 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" - 400.ha.to_si.to_s.should == "4000000.0 m^2" + 400.ha.to_si.to_s.should == "4000000.0 m²" 35.degree_celsius.to_si.to_s.should == "308.15 K" end it "should convert compound units to SI correctly" do speed = Quantity.new 100, (Unit.mi/Unit.h) @@ -216,27 +216,27 @@ (80.kg/2.m/4.s/5.s).to_s(:name).should == '2.0 pascals' end it "should raise a quantity to a power correctly" do unit = 50.ft ** 2 - unit.to_s.should == "2500.0 ft^2" + unit.to_s.should == "2500.0 ft²" unit = 50.ft ** 3 - unit.to_s.should == "125000.0 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^2 s^-2" + unit.to_s.should == "100.0 m² s^-2" unit = (10.m/1.s)**-1 unit.to_s.should == "0.1 s m^-1" 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^2" - (50.ft.pow! 3).to_s.should == "125000.0 ft^3" + (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^2 s^-2" + ((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" lambda{ ((10.m/1.s).pow! 0.5) }.should raise_error end it "should parse using string method" do @@ -255,17 +255,17 @@ it "should rationalize units and return new quantity" do quantity = 12.yards*36.feet quantity.to_s.should eql "432.0 yd ft" new_quantity=quantity.rationalize_units quantity.to_s.should eql "432.0 yd ft" - new_quantity.to_s.should eql "144.0 yd^2" + new_quantity.to_s.should eql "144.0 yd²" end it "should rationalize units and modify value in place" do quantity = 12.yards*36.feet quantity.to_s.should eql "432.0 yd ft" quantity.rationalize_units! - quantity.to_s.should eql "144.0 yd^2" + quantity.to_s.should eql "144.0 yd²" end it "should be greater than" do (20.ft > 1.m).should be_true end