more_money 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.txt +1 -0
- data/lib/more_money/more_money.rb +3 -4
- data/lib/more_money/version.rb +1 -1
- data/test/more_money_test.rb +14 -0
- metadata +2 -2
data/CHANGELOG.txt
CHANGED
@@ -141,11 +141,10 @@ module MoreMoney
|
|
141
141
|
|
142
142
|
def <=>(other_money)
|
143
143
|
if cents == nil
|
144
|
-
return
|
144
|
+
return 0 if other_money.cents == nil
|
145
|
+
return -1
|
145
146
|
elsif currency == other_money.currency
|
146
|
-
return
|
147
|
-
return cents <=> 0 if other_money.cents == nil
|
148
|
-
|
147
|
+
return 1 if other_money.cents == nil
|
149
148
|
cents <=> other_money.cents
|
150
149
|
else
|
151
150
|
cents <=> other_money.exchange_to(currency).cents
|
data/lib/more_money/version.rb
CHANGED
data/test/more_money_test.rb
CHANGED
@@ -93,6 +93,20 @@ class MoreMoneyTest < Test::Unit::TestCase
|
|
93
93
|
assert_equal nil, a.cents
|
94
94
|
end
|
95
95
|
|
96
|
+
def test_nil_comparable
|
97
|
+
a = Money.new(nil)
|
98
|
+
b = Money.new(nil)
|
99
|
+
c = Money.new(0)
|
100
|
+
d = Money.new(0)
|
101
|
+
assert_equal true, (a == b)
|
102
|
+
assert_equal false, (a != b)
|
103
|
+
assert_equal true, (c == d)
|
104
|
+
assert_equal false, (c != d)
|
105
|
+
assert_equal false, (a == c)
|
106
|
+
assert_equal true, (c != a)
|
107
|
+
assert_equal true, (c > a)
|
108
|
+
end
|
109
|
+
|
96
110
|
def test_symbol
|
97
111
|
assert_equal '$', Money.curr_symbol
|
98
112
|
assert_equal '£', Money.curr_symbol('GBP')
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: more_money
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-02-
|
6
|
+
version: 0.0.10
|
7
|
+
date: 2007-02-14 00:00:00 +00:00
|
8
8
|
summary: handles money objects in any currency using just integer as backend
|
9
9
|
require_paths:
|
10
10
|
- lib
|