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 remaining RSpec/LetSetup cops #28368

Closed
wants to merge 35 commits into from

Conversation

mjankowski
Copy link
Contributor

The diff lengthy, but fortunately theres only 1-2 changes in most of the files. Changes in a few categories:

  • The vast majority of these had some setup in a let! that could have been in a before or right in the example, so I just moved them in.
  • One controller spec had a looping construct of hashes and expected results and was using send with a symbol so it was seen as not used. This struck me as more confusing than useful in terms of the compactness, so I unrolled the loop into multiple examples.
  • A few of them actually had a use in the example, so I kept the let and added the usage
  • In one scenario there was a local var being setup for a shared_examples usage, and I left inline comments disabling the cop. At some point I may do a pass at the all the disabled stuff and look for better approach.

@renchap renchap added ruby Pull requests that update Ruby code lint fix 💅 labels Dec 15, 2023
@@ -14,7 +14,6 @@

describe 'GET #index' do
let(:scopes) { 'read:filters' }
let!(:filter) { Fabricate(:custom_filter, account: user.account) }
Copy link
Contributor

Choose a reason for hiding this comment

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

We most likely want to still create an object for this test case

@@ -152,7 +152,7 @@
context 'with follows' do
let(:import_type) { 'following' }

let!(:rows) do
before do
[
{ 'acct' => 'foo@bar' },
{ 'acct' => 'user@bar', 'show_reblogs' => false, 'notify' => true, 'languages' => %w(fr de) },
Copy link
Contributor

Choose a reason for hiding this comment

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

Line below should be an each? Same remark throughout that file.

@ClearlyClaire
Copy link
Contributor

Honestly, I feel like in some cases it splits the test data definitions in ways that make them less readable

@mjankowski
Copy link
Contributor Author

Closing this in favor of submitting smaller PRs -- and I'm also going to do a pass through the whole thing where I add checks that actually do use the currently unused vars, where that makes sense. Will get through that and see what's left.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lint fix 💅 ruby Pull requests that update Ruby code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants