spec/unit_spec.rb in phys-units-1.0.0 vs spec/unit_spec.rb in phys-units-1.0.1
- old
+ new
@@ -5,11 +5,11 @@
describe U[1] do
it {is_expected.to be_an_instance_of Phys::Unit}
its(:factor) {is_expected.to eq 1}
its(:conversion_factor) {is_expected.to eq 1}
its(:name) {is_expected.to be_nil}
- its(:expr) {is_expected.to be_nil}
+ its(:expr) {is_expected.to eq ""}
its(:offset) {is_expected.to be_nil}
its(:dimension) {is_expected.to eq({})}
its(:dimension_value) {is_expected.to eq 1}
its(:string_form) {is_expected.to eq ""}
it {is_expected.to be_dimensionless}
@@ -20,11 +20,11 @@
describe U[2] do
it {is_expected.to be_an_instance_of Phys::Unit}
its(:factor) {is_expected.to eq 2}
its(:conversion_factor) {is_expected.to eq 2}
its(:name) {is_expected.to be_nil}
- its(:expr) {is_expected.to be_nil}
+ its(:expr) {is_expected.to eq "2"}
its(:offset) {is_expected.to be_nil}
its(:dimension) {is_expected.to eq({})}
its(:dimension_value) {is_expected.to eq 1}
its(:string_form) {is_expected.to eq "2"}
it {is_expected.to be_dimensionless}
@@ -35,11 +35,11 @@
describe U['pi'] do
it {is_expected.to be_an_kind_of Phys::Unit}
its(:factor) {is_expected.to eq 1}
its(:conversion_factor) {is_expected.to eq Math::PI}
its(:name) {is_expected.to eq 'pi'}
- its(:expr) {is_expected.to eq '!dimensionless'}
+ its(:expr) {is_expected.to eq 'pi'}
its(:offset) {is_expected.to be_nil}
its(:dimension) {is_expected.to eq({'pi'=>1})}
its(:dimension_value) {is_expected.to eq Math::PI}
its(:string_form) {is_expected.to eq "pi"}
it {is_expected.to be_dimensionless}
@@ -50,11 +50,11 @@
describe U['m'] do
it {is_expected.to be_an_kind_of Phys::Unit}
its(:factor) {is_expected.to eq 1}
its(:conversion_factor) {is_expected.to eq 1}
its(:name) {is_expected.to eq 'm'}
- its(:expr) {is_expected.to eq '!'}
+ its(:expr) {is_expected.to eq 'm'}
its(:offset) {is_expected.to be_nil}
its(:dimension) {is_expected.to eq({'m'=>1})}
its(:dimension_value) {is_expected.to eq 1}
its(:string_form) {is_expected.to eq "m"}
it {is_expected.not_to be_dimensionless}
@@ -86,11 +86,11 @@
it {is_expected.to be_an_kind_of Phys::Unit}
it {is_expected.to eq Phys::Unit[:miles]}
its(:factor) {is_expected.to eq 1609.344}
its(:conversion_factor) {is_expected.to eq 1609.344}
its(:name) {is_expected.to be_nil}
- its(:expr) {is_expected.to be_nil}
+ its(:expr) {is_expected.to eq "1609.344 m"}
its(:offset) {is_expected.to be_nil}
its(:dimension) {is_expected.to eq({'m'=>1})}
its(:dimension_value) {is_expected.to eq 1}
its(:string_form) {is_expected.to eq "1609.344 m"}
it {is_expected.not_to be_dimensionless}
@@ -147,11 +147,11 @@
describe U.parse('123.5 s') do
it {is_expected.to be_an_instance_of Phys::Unit}
its(:factor) {is_expected.to eq 123.5}
its(:conversion_factor) {is_expected.to eq 123.5}
its(:name) {is_expected.to be_nil}
- its(:expr) {is_expected.to be_nil}
+ its(:expr) {is_expected.to eq '123.5 s'}
its(:offset) {is_expected.to be_nil}
its(:dimension) {is_expected.to eq({'s'=>1})}
its(:dimension_value) {is_expected.to eq 1}
its(:string_form) {is_expected.to eq "123.5 s"}
it {is_expected.not_to be_dimensionless}
@@ -162,11 +162,11 @@
describe U['m']/U['s'] do
it {is_expected.to be_an_instance_of Phys::Unit}
its(:factor) {is_expected.to eq 1}
its(:conversion_factor) {is_expected.to eq 1}
its(:name) {is_expected.to be_nil}
- its(:expr) {is_expected.to be_nil}
+ its(:expr) {is_expected.to eq "m s^-1"}
its(:offset) {is_expected.to be_nil}
its(:dimension) {is_expected.to eq({'m'=>1, 's'=>-1})}
its(:dimension_value) {is_expected.to eq 1}
its(:string_form) {is_expected.to eq "m s^-1"}
it {is_expected.not_to be_dimensionless}
@@ -178,11 +178,11 @@
describe U.parse('(m/s)**2') do
it {is_expected.to be_an_instance_of Phys::Unit}
its(:factor) {is_expected.to eq 1}
its(:conversion_factor) {is_expected.to eq 1}
its(:name) {is_expected.to be_nil}
- its(:expr) {is_expected.to be_nil}
+ its(:expr) {is_expected.to eq "m^2 s^-2"}
its(:offset) {is_expected.to be_nil}
its(:dimension) {is_expected.to eq({'m'=>2, 's'=>-2})}
its(:dimension_value) {is_expected.to eq 1}
its(:string_form) {is_expected.to eq "m^2 s^-2"}
it {is_expected.not_to be_dimensionless}
@@ -197,11 +197,11 @@
describe U['tempC'] do
it {is_expected.to be_an_instance_of Phys::OffsetUnit}
its(:factor) {is_expected.to eq 1}
its(:conversion_factor) {is_expected.to eq 1}
its(:name) {is_expected.to eq 'tempC'}
- its(:expr) {is_expected.to be_nil}
+ its(:expr) {is_expected.to eq 'tempC'}
its(:offset) {is_expected.to eq 273.15}
its(:dimension) {is_expected.to eq({'K'=>1})}
its(:dimension_value) {is_expected.to eq 1}
its(:string_form) {is_expected.to eq "K"}
it {is_expected.not_to be_dimensionless}
@@ -213,10 +213,10 @@
it {is_expected.to be_an_instance_of Phys::OffsetUnit}
its(:factor) {is_expected.to eq Rational(5,9)}
its(:factor) {is_expected.to be_an_instance_of Rational}
its(:conversion_factor) {is_expected.to eq Rational(5,9)}
its(:name) {is_expected.to eq 'tempF'}
- its(:expr) {is_expected.to be_nil}
+ its(:expr) {is_expected.to eq 'tempF'}
its(:offset) {is_expected.to eq Rational(45967,180)}
its(:dimension) {is_expected.to eq({'K'=>1})}
its(:dimension_value) {is_expected.to eq 1}
its(:string_form) {is_expected.to eq "(1/1.8) K"}
it {is_expected.not_to be_dimensionless}