Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX+Spec] Fractional not being BigDecimal upon deserialization #232

Merged
merged 3 commits into from Dec 5, 2012

Conversation

@klevo
Copy link

@klevo klevo commented Dec 1, 2012

Loading a YAML serialized money object is a common use case when dealing with persisting the money object in a queue, for example delayed_job. We need to ensure @fractional is BigDecimal before calling #round with two parameters on it. Float class only provides #round with 0 or 1 parameter. Spec included.

…onal can end up being set to a Float. We need to ensure it is BigDecimal before calling #round with two paramers. Float class only provides #round with 0 or 1 parameter. Spec included.
@@ -146,6 +146,35 @@ def expectation.fractional
m.fractional.should be_a(Fixnum)
end
end

it "when loading a serialized Money object from YAML fractional rounding always works on bigdecimal" do

This comment has been minimized.

@semmons99

semmons99 Dec 1, 2012
Member

context "loading a serialized Money via YAML" do
  it "uses BigDecimal when rounding" do
@@ -146,6 +146,35 @@ def expectation.fractional
m.fractional.should be_a(Fixnum)
end
end

it "when loading a serialized Money object from YAML fractional rounding always works on bigdecimal" do
# Loading a YAML serialized money object is a common use case when dealing with persisting the money object in a queue, for example delayed_job

This comment has been minimized.

@semmons99

semmons99 Dec 1, 2012
Member

No real need for this comment, the context+spec should be enough. Also, always try to respect 80 character line widths.

@semmons99
Copy link
Member

@semmons99 semmons99 commented Dec 1, 2012

Please figure out why this is failing with ruby-1.9.2-p320 and fix. Thanks for the patch!

Robert Starsi added 2 commits Dec 2, 2012
semmons99 added a commit that referenced this pull request Dec 5, 2012
[FIX+Spec] Fractional not being BigDecimal upon deserialization
@semmons99 semmons99 merged commit 1cc9e46 into RubyMoney:master Dec 5, 2012
1 check passed
1 check passed
default The Travis build passed
Details
@semmons99
Copy link
Member

@semmons99 semmons99 commented Dec 5, 2012

Thanks for the patch @klevo, sorry I didn't merge it sooner. You now have a commit bit on the repo.

@klevo
Copy link
Author

@klevo klevo commented Dec 5, 2012

awesome, thanks!

On Dec 5, 2012, at 5:21 AM, Shane Emmons notifications@github.com wrote:

Thanks for the patch @klevo, sorry I didn't merge it sooner. You now have a commit bit on the repo.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants