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

New cop to discourage context with only a single test #2001

Open
fatkodima opened this issue Nov 27, 2024 · 0 comments · May be fixed by #2020
Open

New cop to discourage context with only a single test #2001

fatkodima opened this issue Nov 27, 2024 · 0 comments · May be fixed by #2020

Comments

@fatkodima
Copy link

Relevant to #2000.

When the context block has only a single test, it makes little sense to actually use the context block and making the code unnecessary indented and a little more complicated.

# bad
context 'when condition' do
  it 'tests something' do
  end
end

# good
it 'tests something when condition' do
end
tejasbubane added a commit to tejasbubane/rubocop-rspec that referenced this issue Jan 8, 2025
To check context with single example.

Closes rubocop#2001
tejasbubane added a commit to tejasbubane/rubocop-rspec that referenced this issue Jan 8, 2025
To check context with single example.

Closes rubocop#2001
tejasbubane added a commit to tejasbubane/rubocop-rspec that referenced this issue Jan 8, 2025
To check context with single example.

Closes rubocop#2001
tejasbubane added a commit to tejasbubane/rubocop-rspec that referenced this issue Jan 8, 2025
To check context with single example.

Closes rubocop#2001
@tejasbubane tejasbubane linked a pull request Jan 8, 2025 that will close this issue
12 tasks
tejasbubane added a commit to tejasbubane/rubocop-rspec that referenced this issue Jan 8, 2025
To check context with single example.

Closes rubocop#2001
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 a pull request may close this issue.

1 participant