Permalink
Browse files

Merge pull request #1 from nathanbertram/master

Fix for the edge penny case
  • Loading branch information...
2 parents 237c24b + 350da6c commit b56be116efb760e8e433e2447f1b8188a007d612 @willcosgrove committed Sep 20, 2012
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 b56be11

Please sign in to comment.