Skip to content
Snippets Groups Projects
Commit 75739e54 authored by Robert Speicher's avatar Robert Speicher
Browse files

Enable RSpec/NotToNot cop and auto-correct offenses

Also removes the note from the development/testing.md guide
parent 16ca3ee6
No related branches found
No related tags found
No related merge requests found
Showing
with 27 additions and 27 deletions
Loading
@@ -1130,7 +1130,7 @@ RSpec/MultipleDescribes:
Loading
@@ -1130,7 +1130,7 @@ RSpec/MultipleDescribes:
# Enforces the usage of the same method on all negative message expectations. # Enforces the usage of the same method on all negative message expectations.
RSpec/NotToNot: RSpec/NotToNot:
EnforcedStyle: not_to EnforcedStyle: not_to
Enabled: false Enabled: true
   
# Prefer using verifying doubles over normal doubles. # Prefer using verifying doubles over normal doubles.
RSpec/VerifiedDoubles: RSpec/VerifiedDoubles:
Loading
Loading
Loading
@@ -65,7 +65,7 @@ the command line via `bundle exec teaspoon`, or via a web browser at
Loading
@@ -65,7 +65,7 @@ the command line via `bundle exec teaspoon`, or via a web browser at
- Use `context` to test branching logic. - Use `context` to test branching logic.
- Don't `describe` symbols (see [Gotchas](gotchas.md#dont-describe-symbols)). - Don't `describe` symbols (see [Gotchas](gotchas.md#dont-describe-symbols)).
- Don't supply the `:each` argument to hooks since it's the default. - Don't supply the `:each` argument to hooks since it's the default.
- Prefer `not_to` to `to_not`. - Prefer `not_to` to `to_not` (_this is enforced by Rubocop_).
- Try to match the ordering of tests to the ordering within the class. - Try to match the ordering of tests to the ordering within the class.
- Try to follow the [Four-Phase Test][four-phase-test] pattern, using newlines - Try to follow the [Four-Phase Test][four-phase-test] pattern, using newlines
to separate phases. to separate phases.
Loading
Loading
Loading
@@ -158,7 +158,7 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps
Loading
@@ -158,7 +158,7 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps
   
step 'I should not see twitter details' do step 'I should not see twitter details' do
expect(page).to have_content 'Pete' expect(page).to have_content 'Pete'
expect(page).to_not have_content 'twitter' expect(page).not_to have_content 'twitter'
end end
   
step 'click on ssh keys tab' do step 'click on ssh keys tab' do
Loading
Loading
Loading
@@ -106,7 +106,7 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps
Loading
@@ -106,7 +106,7 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps
if pending if pending
expect(page).to have_link 'Done' expect(page).to have_link 'Done'
else else
expect(page).to_not have_link 'Done' expect(page).not_to have_link 'Done'
end end
end end
end end
Loading
Loading
Loading
@@ -105,7 +105,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
Loading
@@ -105,7 +105,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
end end
   
step 'I should not see button to create a new merge request' do step 'I should not see button to create a new merge request' do
expect(page).to_not have_link 'Create Merge Request' expect(page).not_to have_link 'Create Merge Request'
end end
   
step 'I should see button to the merge request' do step 'I should see button to the merge request' do
Loading
Loading
Loading
@@ -39,8 +39,8 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
Loading
@@ -39,8 +39,8 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
   
step 'I can see the activity and food categories' do step 'I can see the activity and food categories' do
page.within '.emoji-menu' do page.within '.emoji-menu' do
expect(page).to_not have_selector 'Activity' expect(page).not_to have_selector 'Activity'
expect(page).to_not have_selector 'Food' expect(page).not_to have_selector 'Food'
end end
end end
   
Loading
Loading
Loading
@@ -216,7 +216,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
Loading
@@ -216,7 +216,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
   
page.within 'li.issue:nth-child(3)' do page.within 'li.issue:nth-child(3)' do
expect(page).to have_content 'Bugfix' expect(page).to have_content 'Bugfix'
expect(page).to_not have_content '0 0' expect(page).not_to have_content '0 0'
end end
end end
end end
Loading
@@ -235,7 +235,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
Loading
@@ -235,7 +235,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
   
page.within 'li.issue:nth-child(3)' do page.within 'li.issue:nth-child(3)' do
expect(page).to have_content 'Bugfix' expect(page).to have_content 'Bugfix'
expect(page).to_not have_content '0 0' expect(page).not_to have_content '0 0'
end end
end end
end end
Loading
Loading
Loading
@@ -203,7 +203,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
Loading
@@ -203,7 +203,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
   
page.within 'li.merge-request:nth-child(3)' do page.within 'li.merge-request:nth-child(3)' do
expect(page).to have_content 'Bug NS-05' expect(page).to have_content 'Bug NS-05'
expect(page).to_not have_content '0 0' expect(page).not_to have_content '0 0'
end end
end end
end end
Loading
@@ -222,7 +222,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
Loading
@@ -222,7 +222,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
   
page.within 'li.merge-request:nth-child(3)' do page.within 'li.merge-request:nth-child(3)' do
expect(page).to have_content 'Bug NS-05' expect(page).to have_content 'Bug NS-05'
expect(page).to_not have_content '0 0' expect(page).not_to have_content '0 0'
end end
end end
end end
Loading
Loading
Loading
@@ -107,7 +107,7 @@ module SharedNote
Loading
@@ -107,7 +107,7 @@ module SharedNote
end end
   
step 'I should see no notes at all' do step 'I should see no notes at all' do
expect(page).to_not have_css('.note') expect(page).not_to have_css('.note')
end end
   
# Markdown # Markdown
Loading
Loading
Loading
@@ -17,7 +17,7 @@ describe Admin::ProjectsController do
Loading
@@ -17,7 +17,7 @@ describe Admin::ProjectsController do
   
it 'does not retrieve the project' do it 'does not retrieve the project' do
get :index, visibility_levels: [Gitlab::VisibilityLevel::INTERNAL] get :index, visibility_levels: [Gitlab::VisibilityLevel::INTERNAL]
expect(response.body).to_not match(project.name) expect(response.body).not_to match(project.name)
end end
end end
end end
Loading
@@ -19,7 +19,7 @@ describe Projects::CompareController do
Loading
@@ -19,7 +19,7 @@ describe Projects::CompareController do
to: ref_to) to: ref_to)
   
expect(response).to be_success expect(response).to be_success
expect(assigns(:diffs).first).to_not be_nil expect(assigns(:diffs).first).not_to be_nil
expect(assigns(:commits).length).to be >= 1 expect(assigns(:commits).length).to be >= 1
end end
   
Loading
@@ -32,7 +32,7 @@ describe Projects::CompareController do
Loading
@@ -32,7 +32,7 @@ describe Projects::CompareController do
w: 1) w: 1)
   
expect(response).to be_success expect(response).to be_success
expect(assigns(:diffs).first).to_not be_nil expect(assigns(:diffs).first).not_to be_nil
expect(assigns(:commits).length).to be >= 1 expect(assigns(:commits).length).to be >= 1
# without whitespace option, there are more than 2 diff_splits # without whitespace option, there are more than 2 diff_splits
diff_splits = assigns(:diffs).first.diff.split("\n") diff_splits = assigns(:diffs).first.diff.split("\n")
Loading
Loading
Loading
@@ -43,7 +43,7 @@ describe Projects::GroupLinksController do
Loading
@@ -43,7 +43,7 @@ describe Projects::GroupLinksController do
end end
   
it 'does not share project with that group' do it 'does not share project with that group' do
expect(group.shared_projects).to_not include project expect(group.shared_projects).not_to include project
end end
end end
end end
Loading
Loading
Loading
@@ -56,7 +56,7 @@ describe Projects::IssuesController do
Loading
@@ -56,7 +56,7 @@ describe Projects::IssuesController do
move_issue move_issue
   
expect(response).to have_http_status :found expect(response).to have_http_status :found
expect(another_project.issues).to_not be_empty expect(another_project.issues).not_to be_empty
end end
end end
   
Loading
Loading
Loading
@@ -38,7 +38,7 @@ describe Projects::ProjectMembersController do
Loading
@@ -38,7 +38,7 @@ describe Projects::ProjectMembersController do
include_context 'import applied' include_context 'import applied'
   
it 'does not import team members' do it 'does not import team members' do
expect(project.team_members).to_not include member expect(project.team_members).not_to include member
end end
   
it 'responds with not found' do it 'responds with not found' do
Loading
Loading
Loading
@@ -16,7 +16,7 @@ describe RegistrationsController do
Loading
@@ -16,7 +16,7 @@ describe RegistrationsController do
it 'logs user in directly' do it 'logs user in directly' do
post(:create, user_params) post(:create, user_params)
expect(ActionMailer::Base.deliveries.last).to be_nil expect(ActionMailer::Base.deliveries.last).to be_nil
expect(subject.current_user).to_not be_nil expect(subject.current_user).not_to be_nil
end end
end end
   
Loading
Loading
Loading
@@ -47,7 +47,7 @@ describe SessionsController do
Loading
@@ -47,7 +47,7 @@ describe SessionsController do
authenticate_2fa(login: another_user.username, authenticate_2fa(login: another_user.username,
otp_attempt: another_user.current_otp) otp_attempt: another_user.current_otp)
   
expect(subject.current_user).to_not eq another_user expect(subject.current_user).not_to eq another_user
end end
end end
   
Loading
@@ -56,7 +56,7 @@ describe SessionsController do
Loading
@@ -56,7 +56,7 @@ describe SessionsController do
authenticate_2fa(login: another_user.username, authenticate_2fa(login: another_user.username,
otp_attempt: 'invalid') otp_attempt: 'invalid')
   
expect(subject.current_user).to_not eq another_user expect(subject.current_user).not_to eq another_user
end end
end end
   
Loading
@@ -73,7 +73,7 @@ describe SessionsController do
Loading
@@ -73,7 +73,7 @@ describe SessionsController do
before { authenticate_2fa(otp_attempt: 'invalid') } before { authenticate_2fa(otp_attempt: 'invalid') }
   
it 'does not authenticate' do it 'does not authenticate' do
expect(subject.current_user).to_not eq user expect(subject.current_user).not_to eq user
end end
   
it 'warns about invalid OTP code' do it 'warns about invalid OTP code' do
Loading
Loading
Loading
@@ -6,7 +6,7 @@ describe 'factories' do
Loading
@@ -6,7 +6,7 @@ describe 'factories' do
let(:entity) { build(factory.name) } let(:entity) { build(factory.name) }
   
it 'does not raise error when created' do it 'does not raise error when created' do
expect { entity }.to_not raise_error expect { entity }.not_to raise_error
end end
   
it 'should be valid', if: factory.build_class < ActiveRecord::Base do it 'should be valid', if: factory.build_class < ActiveRecord::Base do
Loading
Loading
Loading
@@ -79,7 +79,7 @@ describe "Admin Runners" do
Loading
@@ -79,7 +79,7 @@ describe "Admin Runners" do
end end
   
it 'changes registration token' do it 'changes registration token' do
expect(page_token).to_not eq token expect(page_token).not_to eq token
end end
end end
end end
Loading
Loading
Loading
@@ -152,7 +152,7 @@ describe "Admin::Users", feature: true do
Loading
@@ -152,7 +152,7 @@ describe "Admin::Users", feature: true do
it 'sees impersonation log out icon' do it 'sees impersonation log out icon' do
icon = first('.fa.fa-user-secret') icon = first('.fa.fa-user-secret')
   
expect(icon).to_not eql nil expect(icon).not_to eql nil
end end
   
it 'can log out of impersonated user back to original user' do it 'can log out of impersonated user back to original user' do
Loading
Loading
Loading
@@ -47,7 +47,7 @@ describe "Builds" do
Loading
@@ -47,7 +47,7 @@ describe "Builds" do
it { expect(page).to have_content @build.short_sha } it { expect(page).to have_content @build.short_sha }
it { expect(page).to have_content @build.ref } it { expect(page).to have_content @build.ref }
it { expect(page).to have_content @build.name } it { expect(page).to have_content @build.name }
it { expect(page).to_not have_link 'Cancel running' } it { expect(page).not_to have_link 'Cancel running' }
end end
end end
   
Loading
@@ -63,7 +63,7 @@ describe "Builds" do
Loading
@@ -63,7 +63,7 @@ describe "Builds" do
it { expect(page).to have_content @build.short_sha } it { expect(page).to have_content @build.short_sha }
it { expect(page).to have_content @build.ref } it { expect(page).to have_content @build.ref }
it { expect(page).to have_content @build.name } it { expect(page).to have_content @build.name }
it { expect(page).to_not have_link 'Cancel running' } it { expect(page).not_to have_link 'Cancel running' }
end end
   
describe "GET /:project/builds/:id" do describe "GET /:project/builds/:id" do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment