test/test_currency.rb in shanna-big_money-0.2.2 vs test/test_currency.rb in shanna-big_money-0.3.0
- old
+ new
@@ -1,23 +1,27 @@
-require 'test/unit'
-require 'big_money'
+# coding: utf-8
+require 'helper'
class TestCurrency < Test::Unit::TestCase
- def test_parse
- assert_kind_of BigMoney::Currency, BigMoney::Currency.parse(:aud)
- assert_nil BigMoney::Currency.parse(:fud)
- end
+ context BigMoney::Currency do
+ should 'find' do
+ assert_kind_of BigMoney::Currency, BigMoney::Currency.find(:aud)
+ assert_raise(ArgumentError) do
+ BigMoney::Currency.find(:fud)
+ end
+ end
- def test_compare
- aud = BigMoney::Currency::AUD.instance
- assert_operator aud, :==, :aud
- assert_operator aud, :==, :AUD
- assert_operator aud, :==, 'aud'
- assert_operator aud, :==, 'AUD'
+ should 'be comparable' do
+ aud = BigMoney::Currency::AUD.instance
+ assert_operator aud, :==, :aud
+ assert_operator aud, :==, :AUD
+ assert_operator aud, :==, 'aud'
+ assert_operator aud, :==, 'AUD'
- # assert_operator aud, '!=', :fud
- assert aud != :fud
- assert aud != :FUD
- assert aud != 'fud'
- assert aud != 'FUD'
+ # assert_operator aud, '!=', :fud
+ assert aud != :fud
+ assert aud != :FUD
+ assert aud != 'fud'
+ assert aud != 'FUD'
+ end
end
end