-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Refactor and add specs to stock locations helper #3827
Refactor and add specs to stock locations helper #3827
Conversation
6f35c73
to
67717d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the behaviour when the admin_name
or name
are empty/blank strings rather than nil
values.
Ideally the new specs should enforce this behaviour that your changes might otherwise have broken.
Hey @gabrielbaldao, it's been a while, but would you like to finish it with Jared's suggestion? |
02b6930
to
7ce819f
Compare
I did it myself. It should be ready for review 🙂 |
thank you @waiting-for-dev i appreciate that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gabrielbaldao @waiting-for-dev thanks!
subject { helper.admin_stock_location_display_name(stock_location) } | ||
|
||
context "without admin_name" do | ||
let(:stock_location) { create(:stock_location_with_items) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we set the name explicitly, both here and in the let
statement below? Right now "NY Warehouse" is a magic string and relies on the factory's defaults—it would be good to make it explicit, for clarity and so that any changes in the factory don't affect the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes a lot of sense. Thanks for the suggestion. Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, pending Alessandro's request to update the tests so that the value the output depends on is explicit in the setup.
7ce819f
to
6ef1800
Compare
Checklist: