Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

convert test to spec for creating units with negative powers

  • Loading branch information...
commit 3427425cf58244ea94b4f74fe218416871192d1f 1 parent 0296164
@olbrich authored
Showing with 13 additions and 7 deletions.
  1. +13 −0 spec/ruby-units/unit_spec.rb
  2. +0 −7 test/test_ruby-units.rb
View
13 spec/ruby-units/unit_spec.rb
@@ -411,6 +411,19 @@
its(:temperature_scale) {should be_nil}
end
+ describe Unit.new("1 m^2 s^-2") do
+ it {should be_an_instance_of Unit}
+ its(:scalar) {should be_an Integer}
+ its(:units) {should == "m^2/s^2"}
+ its(:kind) {should == :radiation}
+ it {should_not be_temperature}
+ it {should_not be_degree}
+ it {should be_base}
+ it {should_not be_unitless}
+ it {should_not be_zero}
+ its(:base) {should be_a Numeric}
+ its(:temperature_scale) {should be_nil}
+ end
end
View
7 test/test_ruby-units.rb
@@ -98,13 +98,6 @@ def test_to_unit
assert_in_delta 1, unit1.scalar, 0.001
assert_equal ['<milli>','<meter>'], unit1.numerator
end
-
- def test_create_with_negative_powers
- unit1 = Unit.new("1 m^2 s^-2")
- assert_equal 1, unit1.scalar
- assert_equal ['<meter>','<meter>'],unit1.numerator
- assert_equal ['<second>','<second>'],unit1.denominator
- end
def test_create_from_array
unit1 = Unit.new(1, "mm^2", "ul^2")
Please sign in to comment.
Something went wrong with that request. Please try again.