Permalink
Browse files

Get your pennies in check!

  • Loading branch information...
nathanbertram committed Sep 20, 2012
1 parent 237c24b commit 350da6c0c47c082cc155e3f77da4cda4af703364
Showing with 5 additions and 2 deletions.
  1. +1 −1 lib/priceable.rb
  2. +1 −1 lib/priceable/version.rb
  3. +3 −0 spec/priceable_spec.rb
View
@@ -14,7 +14,7 @@ def priceable(*price_fields)
end
end
define_method "#{price_field}=".to_sym do |new_price|
- send("#{price_field}#{suffix}=".to_sym, new_price.to_f * 100)
+ send("#{price_field}#{suffix}=".to_sym, (new_price.to_f * 100).round)
end
end
if self._accessible_attributes?
View
@@ -1,3 +1,3 @@
module Priceable
- VERSION = "0.0.5"
+ VERSION = "0.0.6"
end
View
@@ -11,6 +11,9 @@
it "should create a setter method" do
llama.price = 200.10
llama.price_in_cents.should == 20010
+
+ llama.price = 285.53
+ llama.price_in_cents.should == 28553
end
it "should return 0.0 if nil" do

0 comments on commit 350da6c

Please sign in to comment.