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 an incorrect autocorrect for Capybara/PathExpectation #17

Merged
merged 1 commit into from
Jan 9, 2023

Conversation

ydah
Copy link
Member

@ydah ydah commented Jan 9, 2023

This PR is fix an incorrect autocorrect for Capybara/PathExpectation.

-expect(page).to have_current_path `pwd`
+expect(page).to have_current_path `pwd`, ignore_query: true

expect(page).to have_current_path "/callback" \
-                            "/foo"
+                            "/foo", ignore_query: true

Before submitting the PR make sure the following are checked:

  • Feature branch is up-to-date with main (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • [-] Updated documentation.
  • Added an entry to the CHANGELOG.md if the new code introduces user-observable changes.
  • The build (bundle exec rake) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).

@ydah ydah changed the title Fix an incorrect autocorrect for Capybara/PathExpectation when register an offense with match Fix an incorrect autocorrect for Capybara/PathExpectation Jan 9, 2023
This PR is fix an incorrect autocorrect for `Capybara/PathExpectation`.

```diff
-expect(page).to have_current_path `pwd`
+expect(page).to have_current_path `pwd`, ignore_query: true

expect(page).to have_current_path "/callback" \
-                            "/foo"
+                            "/foo", ignore_query: true
```
Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

end

it 'flags violations for `expect(current_path)` with a `command`' do
expect_offense(<<~'RUBY')
Copy link
Member

Choose a reason for hiding this comment

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

Is quoting of RUBY necessary in this one?

@pirj pirj merged commit 7b3ccf6 into main Jan 9, 2023
@pirj pirj deleted the fix-autocorrect-CurrentPathExpectation branch January 9, 2023 22:04
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.

2 participants