Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d92a3f3987
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (25 sloc) 0.781 kb
$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'test/unit'
require 'money'
class CoreExtensionsTest < Test::Unit::TestCase
def setup
end
def test_numeric_conversion
assert_equal Money.new(10000), 100.to_money
assert_equal Money.new(10038), 100.38.to_money
assert_equal Money.new(-10000), -100.to_money
end
def test_string_conversion
assert_equal Money.new(100), "$1".to_money
assert_equal Money.new(100), "$1.00".to_money
assert_equal Money.new(137), "$1.37".to_money
assert_equal Money.new(100, 'CAD'), "CAD $1.00".to_money
assert_equal Money.new(-10000), "-100".to_money
assert_equal Money.new(410), "4.10".to_money
end
def test_nil
assert_raise(NoMethodError) do
nil.to_money
end
end
end
Jump to Line
Something went wrong with that request. Please try again.