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 #495] Default rails console strategy configuration #780

Merged

Conversation

Vitalina-Vakulchyk
Copy link
Contributor

@Vitalina-Vakulchyk Vitalina-Vakulchyk commented Apr 1, 2021

Remove default setting of :urgent strategy for console if there is another current strategy.

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Updated tests.
  • Added an entry to the changelog if the new code introduces user-observable changes. See changelog entry format for details.

@Vitalina-Vakulchyk Vitalina-Vakulchyk force-pushed the defaul-rails-console-strategy-configuration branch from 87ef907 to f71f39b Compare April 1, 2021 13:24
Copy link
Contributor

@dalthon dalthon left a 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.

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
lib/chewy/config.rb Outdated Show resolved Hide resolved
lib/chewy/type/witchcraft.rb Outdated Show resolved Hide resolved
@barthez
Copy link
Contributor

barthez commented Apr 1, 2021

Will it close #495?

.rubocop.yml Outdated
@@ -2,6 +2,7 @@ inherit_from: .rubocop_todo.yml

AllCops:
NewCops: enable
TargetRubyVersion: 2.7
Copy link
Contributor

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.

Copy link
Contributor

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
Copy link
Contributor Author

@barthez Yes, this PR will solve this issue #495
I am going to leave the accompanying comment there after merging.

@dalthon
Copy link
Contributor

dalthon commented Apr 1, 2021

@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.
It helps us to keep track of PRs and Issues and I believe it automatically closes the issue once this PR is merged

@Vitalina-Vakulchyk Vitalina-Vakulchyk changed the title Default rails console strategy configuration [Fix #495] Default rails console strategy configuration Apr 1, 2021
@Vitalina-Vakulchyk
Copy link
Contributor Author

Thank you! I have changed the PR name.

@Vitalina-Vakulchyk Vitalina-Vakulchyk force-pushed the defaul-rails-console-strategy-configuration branch from 6eb947c to 2dbebb4 Compare April 2, 2021 13:52
Copy link
Contributor

@rabotyaga rabotyaga left a 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

CHANGELOG.md Outdated Show resolved Hide resolved
lib/chewy/config.rb Outdated Show resolved Hide resolved
Copy link
Contributor

@rabotyaga rabotyaga left a comment

Choose a reason for hiding this comment

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

What about tests?

@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

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

lib/chewy/config.rb Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@dalthon
Copy link
Contributor

dalthon commented Apr 2, 2021

@rabotyaga how do you think this should be tested?
Adding rails as a test dependency just to invoke Rails::Console.new like is tested at Rails itself just to capture its IO?
Do you think that it worth? Or have other idea about how to do it?

@rabotyaga
Copy link
Contributor

@rabotyaga how do you think this should be tested?
Adding rails as a test dependency just to invoke Rails::Console.new like is tested at Rails itself just to capture its IO?
Do you think that it worth? Or have other idea about how to do it?

We could add just a couple of lines to https://github.com/toptal/chewy/blob/master/spec/chewy/config_spec.rb

@Vitalina-Vakulchyk
Copy link
Contributor Author

Vitalina-Vakulchyk commented Apr 5, 2021

@rabotyaga I added the test for default console_strategy value.

Copy link
Contributor

@rabotyaga rabotyaga left a 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?

@Vitalina-Vakulchyk
Copy link
Contributor Author

@rabotyaga I have added setter spec.


describe '.console_strategy' do
context 'sets .console_strategy' do
let(:strategy) { :atomic }
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@Vitalina-Vakulchyk Vitalina-Vakulchyk merged commit 86ee881 into master Apr 5, 2021
@Vitalina-Vakulchyk Vitalina-Vakulchyk deleted the defaul-rails-console-strategy-configuration branch April 5, 2021 12:25
cyucelen pushed a commit to cyucelen/chewy that referenced this pull request Jan 28, 2023
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.

4 participants