-
Notifications
You must be signed in to change notification settings - Fork 24
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
Rubocop rspec #4660
Open
KludgeKML
wants to merge
18
commits into
main
Choose a base branch
from
rubocop-rspec
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Rubocop rspec #4660
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- the component gem isn't a rails app, but has rails features since it's an engine, and we're using rspec as our test runner, so we should try to adhere to our rubocop-enforced style for that.
- Run rubocop -a
- run rubocop -A - since these are unsafe, they have been checked manually more thoroughly. They all seem to be reasonable.
- visible false finds hidden and invisible elements, it's fairly clear from the contexts here that :hidden is actually what's wanted.
- these two are fairly simple, it just wants expectations rather than raw asserts, so re-write
- There was genuinely no expectation in this example, I believe it's testing for console messages but not sure, a frontender could check this.
- It's not clear whether this test is actually testing anything, or if it's to run the visual regressions for other purposes. To confirm with a frontender.
- these are all just presenters, so should be in the presenter path. We lose a bit of context maybe, so frontenders should confirm this is okay.
- To look at. Are these testing the right thing?
- since we can safely nest the capybara based tests for Radio inside the top describe, do that.
- this is clearly a copy-pasto, the second describe group's examples are all about title rather than target.
- these are gnarly problems, outside of the scope of this PR to fix, so disable them. - feedback arguably shouldn't be using request as an object inside the component (the path info should be passed to it, which would allow this to be tested without the allow_any_instance_of.) But this is the current behaviour, so we live with it for now. - layout_for_admin wants us to peer inside ActionView::Base. There's some discussion of why this is here: 5ba7778 ...and here: #3993 (comment)
72e4736
to
e9fc440
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Turn on rails and rspec rubocops, and make current rspec code compliant with the new cops.
Why
Currently we're only using the default config file for govuk-rubocop, but we have an rspec test suite and this is technically a rails app since it's an engine, so we should be using the extended configurations for rails and rspec.
Visual Changes
No visual changes.