-
Notifications
You must be signed in to change notification settings - Fork 368
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 #495] Default rails console strategy configuration #780
[Fix #495] Default rails console strategy configuration #780
Conversation
87ef907
to
f71f39b
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.
🚀 LGTM!
Just left a few comments that you can change if you like and one detail that might cause some issues with Ruby 2.5, but I will not block this PR.
Will it close #495? |
.rubocop.yml
Outdated
@@ -2,6 +2,7 @@ inherit_from: .rubocop_todo.yml | |||
|
|||
AllCops: | |||
NewCops: enable | |||
TargetRubyVersion: 2.7 |
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.
As Dalton mentioned, we aim for 2.5. Please set it up here as well.
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.
We check only 2.6, 2.7 & 3.0. Let's aim for 2.6 and fix the README!
@Vitalina-Vakulchyk I guess @barthez asked about solving that issue because then you can follow that check on PR description: Commit message starts with [Fix #issue-number] (if the related issue exists). and rename your PR description accordingly. |
Thank you! I have changed the PR name. |
6cb8572
to
6eb947c
Compare
6eb947c
to
2dbebb4
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.
Please add a 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.
What about tests?
lib/chewy/railtie.rb
Outdated
@@ -37,7 +37,8 @@ def migrate(*args) | |||
if app.sandbox? | |||
Chewy.strategy(:bypass) | |||
else | |||
Chewy.strategy(:urgent) | |||
strategy = Chewy.console_strategy || :urgent | |||
Chewy.strategy(strategy) |
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.
Let's initialize it properly in https://github.com/toptal/chewy/pull/780/files#diff-542f2b8cbb20f056db635819b1e65c367d4e8fdb9b7e6ae000ecda0c107f1127R52-R64
@rabotyaga how do you think this should be tested? |
We could add just a couple of lines to https://github.com/toptal/chewy/blob/master/spec/chewy/config_spec.rb |
@rabotyaga I added the test for default console_strategy value. |
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 test setter also?
@rabotyaga I have added setter spec. |
spec/chewy/config_spec.rb
Outdated
|
||
describe '.console_strategy' do | ||
context 'sets .console_strategy' do | ||
let(:strategy) { :atomic } |
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.
Should we use the after
hook to prevent the leak of the state?
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.
@rabotyaga Thank you for noticing this.
I added the after
hook.
Remove default setting of :urgent strategy for console if there is another current strategy.
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).Updated tests.