I have a passing interest in Git. I haven’t migrated my projects over to it now, but am looking into it. Just for fun, I googled “ruby git”, and I found Ruby/Git. I thought more people should know about this.

Hongli Lai took the lead/moved Money to GitHub. And the bug didn’t exist a couple of days after I wrote this entry originally.

The Money library is a useful. Unfortunately, release 1.5.9 has an error. One cannot substract an amount from the empty Money.

1 def test_substract_from_zero
2 assert_equal -12.to_money, Money.empty – (12.to_money)
3 end

The test case will fail with this:

1 1) Failure:
2 test_substract_from_zero(MoneyTest) [./test/unit/money_test.rb:29]:
3 <#<Money:0×3accb68 @cents=-1200, @currency="USD">> expected but was
4 <#<Money:0×3acca60 @cents=1200, @currency="USD">>.

The error is caused by Money#-(other_money):

1 def -(other_money)
2 return other_money.dup if cents.zero?
4 end

return other_money.dup if cents.zero? should be removed to allow the test case to pass.

Update (2006-02-13): Tobias already posted a new version of the library, available as a gem.


Your Host

A picture of me

I am François Beausoleil, a Ruby on Rails and Scala developer. During the day, I work on Seevibes, a platform to measure social interactions related to TV shows. At night, I am interested many things. Read my biography.

Top Tags

Books I read and recommend


Projects I work on

Projects I worked on