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

Set Money.default_currency to nil. #868

Conversation

thealiilman
Copy link

This PR closes #855.

@thealiilman thealiilman force-pushed the enhancement/855-made-default-currency-to-be-nil branch from 39c3bba to bfc017e Compare May 21, 2019 17:57
@thealiilman thealiilman changed the title Enhanced default_currency to force developer(s) to set its value. Made default_currency to be nil. May 21, 2019
@thealiilman thealiilman force-pushed the enhancement/855-made-default-currency-to-be-nil branch 2 times, most recently from 15b015e to 633f0b1 Compare May 22, 2019 09:38
@thealiilman thealiilman changed the title Made default_currency to be nil. Set Money.default_currency to be nil. May 22, 2019
@thealiilman thealiilman marked this pull request as ready for review May 22, 2019 09:44
@thealiilman thealiilman changed the title Set Money.default_currency to be nil. Set Money.default_currency to nil. May 22, 2019
@thealiilman thealiilman force-pushed the enhancement/855-made-default-currency-to-be-nil branch from 633f0b1 to bd2b050 Compare May 22, 2019 09:48
@coveralls
Copy link

coveralls commented May 22, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling 757249b on thealiilman:enhancement/855-made-default-currency-to-be-nil into 3f9ecc2 on RubyMoney:v7_new.

spec/money_spec.rb Outdated Show resolved Hide resolved
spec/money_spec.rb Outdated Show resolved Hide resolved
@@ -181,29 +181,35 @@
end

it "accepts an optional currency" do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably split these tests into context — with a default_currency set and with it being nil, because the behaviour is different. From what I can tell right now a case when a default_currency is nil and you initialize it without a currency is untested.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably split these tests into context — with a default_currency set and with it being nil, because the behaviour is different. From what I can tell right now a case when a default_currency is nil and you initialize it without a currency is untested.

these tests being, for Money.from_amount or for others such as Money#amount etc? 🤓
I have added two more contexts in .from_amount's block.

lib/money/currency.rb Outdated Show resolved Hide resolved
lib/money/currency.rb Outdated Show resolved Hide resolved
lib/money/currency.rb Outdated Show resolved Hide resolved
@antstorm
Copy link
Contributor

@thealiilman thanks for looking at this! I've left some comments

@thealiilman thealiilman force-pushed the enhancement/855-made-default-currency-to-be-nil branch 4 times, most recently from d859bdd to 3530762 Compare May 26, 2019 09:40
@thealiilman
Copy link
Author

Thanks for the feedback @antstorm! I've pushed the changes based on your comments, also left a question regarding splitting the tests into contexts. 🙂

@thealiilman thealiilman force-pushed the enhancement/855-made-default-currency-to-be-nil branch from 3530762 to 757249b Compare May 30, 2019 13:56
@antstorm
Copy link
Contributor

antstorm commented Jun 1, 2019

Looks great, thank you! 👍

@antstorm antstorm merged commit cc96c88 into RubyMoney:v7_new Jun 1, 2019
antstorm pushed a commit that referenced this pull request Jun 10, 2019
antstorm pushed a commit that referenced this pull request Jun 18, 2019
antstorm pushed a commit that referenced this pull request Jul 15, 2019
antstorm pushed a commit that referenced this pull request May 16, 2020
antstorm pushed a commit that referenced this pull request Jul 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants