Permalink
Browse files

remove more tests and convert to specs

  • Loading branch information...
1 parent 9c38316 commit 3b67590ce53a5fe2967dc085d4fb3e93b483c963 @olbrich olbrich committed Feb 5, 2012
Showing with 17 additions and 29 deletions.
  1. +16 −0 spec/ruby-units/unit_spec.rb
  2. +1 −29 test/test_ruby-units.rb
@@ -424,6 +424,22 @@
its(:base) {should be_a Numeric}
its(:temperature_scale) {should be_nil}
end
+
+ #scientific notation
+ describe Unit.new("1e6 cells") do
+ it {should be_an_instance_of Unit}
+ its(:scalar) {should be_an Integer}
+ its(:scalar) {should == 1e6 }
+ its(:units) {should == "cells"}
+ its(:kind) {should == :unitless}
+ it {should_not be_temperature}
+ it {should_not be_degree}
+ it {should_not 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
@@ -226,41 +226,13 @@ def test_inspect
assert_not_equal "1.0 mm", unit1.inspect(:dump)
end
- def test_scientific
- a = Unit "1e6 cells"
- assert_equal 1e6, a.scalar
- assert_equal "cells", a.units
- end
-
if defined?(Uncertain)
def test_uncertain
a = '1 +/- 1 mm'.unit
assert_equal a.to_s, '1 +/- 1 mm'
end
end
-
- def test_bad_units
- assert_raises(ArgumentError) { '1 doohickey / thingamabob'.unit}
- assert_raises(ArgumentError) { '1 minimeter'.unit}
- end
-
- def test_currency
- assert_nothing_raised {"$1".unit}
- end
-
- def test_percent
- assert_nothing_raised {
- "1 percent".unit
- "1%".unit
- "0.01%".unit
- }
- a = '100 ml'.unit
- b = '50%'.unit
- c = a*b >> 'ml'
- assert c =~ a
- assert_in_delta '50 ml'.unit.scalar, c.scalar, 0.0001
- end
-
+
def test_time_conversions
today = Time.now
assert_equal today,@april_fools

0 comments on commit 3b67590

Please sign in to comment.