Commit e34e4588 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'rails-save-bang-8' into 'master'

Fix rubocop offenses for ee/spec/features/*

See merge request gitlab-org/gitlab!38289
parents 87f9fd25 9001a23b
......@@ -1249,24 +1249,6 @@ Rails/SaveBang:
Exclude:
- 'ee/spec/controllers/projects/merge_requests_controller_spec.rb'
- 'ee/spec/controllers/subscriptions_controller_spec.rb'
- 'ee/spec/features/admin/admin_users_spec.rb'
- 'ee/spec/features/admin/geo/admin_geo_nodes_spec.rb'
- 'ee/spec/features/admin/licenses/admin_views_license_spec.rb'
- 'ee/spec/features/boards/scoped_issue_board_spec.rb'
- 'ee/spec/features/ci_shared_runner_warnings_spec.rb'
- 'ee/spec/features/dashboards/operations_spec.rb'
- 'ee/spec/features/issues/gfm_autocomplete_ee_spec.rb'
- 'ee/spec/features/merge_request/user_approves_spec.rb'
- 'ee/spec/features/merge_requests/user_views_all_merge_requests_spec.rb'
- 'ee/spec/features/projects/members/invite_group_and_members_spec.rb'
- 'ee/spec/features/projects/merge_requests/user_approves_merge_request_spec.rb'
- 'ee/spec/features/projects/mirror_spec.rb'
- 'ee/spec/features/projects/new_project_spec.rb'
- 'ee/spec/features/projects/settings/user_manages_approval_settings_spec.rb'
- 'ee/spec/features/projects/settings/user_manages_members_spec.rb'
- 'ee/spec/features/search/elastic/global_search_spec.rb'
- 'ee/spec/features/security/project/internal_access_spec.rb'
- 'ee/spec/features/security/project/public_access_spec.rb'
- 'ee/spec/finders/epics_finder_spec.rb'
- 'ee/spec/finders/security/vulnerabilities_finder_spec.rb'
- 'ee/spec/frontend/fixtures/analytics.rb'
......
---
title: Refactor ee/spec/features/* to fix SaveBang Cop
merge_request: 38289
author: Rajendra Kadam
type: fixed
......@@ -46,7 +46,7 @@ RSpec.describe "Admin::Users" do
describe "GET /admin/users/:id" do
describe 'Shared runners quota status' do
before do
user.namespace.update(shared_runners_minutes_limit: 500)
user.namespace.update!(shared_runners_minutes_limit: 500)
end
context 'with projects with shared runners enabled' do
......
......@@ -95,7 +95,7 @@ RSpec.describe 'admin Geo Nodes', :js, :geo do
secondary_only_fields = %w(node-selective-synchronization-field node-repository-capacity-field node-file-capacity-field node-object-storage-field)
it 'when primary renders only primary fields' do
geo_node.update(primary: true)
geo_node.update!(primary: true)
visit edit_admin_geo_node_path(geo_node)
expect_fields(primary_only_fields)
......@@ -103,7 +103,7 @@ RSpec.describe 'admin Geo Nodes', :js, :geo do
end
it 'when secondary renders only secondary fields' do
geo_node.update(primary: false)
geo_node.update!(primary: false)
visit edit_admin_geo_node_path(geo_node)
expect_no_fields(primary_only_fields)
......@@ -138,7 +138,7 @@ RSpec.describe 'admin Geo Nodes', :js, :geo do
describe 'update an existing Geo Node' do
before do
geo_node.update(primary: true)
geo_node.update!(primary: true)
visit edit_admin_geo_node_path(geo_node)
end
......
......@@ -33,12 +33,12 @@ RSpec.describe "Admin views license" do
end
context "when license expired" do
let_it_be(:license) { build(:license, data: build(:gitlab_license, expires_at: Date.yesterday).export).save(validate: false) }
let_it_be(:license) { build(:license, data: build(:gitlab_license, expires_at: Date.yesterday).export).save!(validate: false) }
it { expect(page).to have_content("Your subscription expired!") }
context "when license blocks changes" do
let_it_be(:license) { build(:license, data: build(:gitlab_license, expires_at: Date.yesterday, block_changes_at: Date.today).export).save(validate: false) }
let_it_be(:license) { build(:license, data: build(:gitlab_license, expires_at: Date.yesterday, block_changes_at: Date.today).export).save!(validate: false) }
it { expect(page).to have_content "You didn't renew your Starter subscription so it was downgraded to the GitLab Core Plan" }
end
......
......@@ -391,7 +391,7 @@ RSpec.describe 'Scoped issue boards', :js do
let!(:list) { create(:list, board: board, label: project_label, position: 0) }
it 'removes issues milestone when removing from the board' do
board.update(milestone: milestone, assignee: user)
board.update!(milestone: milestone, assignee: user)
visit project_boards_path(project)
wait_for_requests
......
......@@ -33,7 +33,7 @@ RSpec.describe 'CI shared runner limits' do
end
before do
group.update(shared_runners_minutes_limit: 20)
group.update!(shared_runners_minutes_limit: 20)
allow_any_instance_of(EE::Namespace).to receive(:shared_runners_remaining_minutes).and_return(remaining_minutes)
end
......@@ -124,7 +124,7 @@ RSpec.describe 'CI shared runner limits' do
end
before do
group.update(shared_runners_minutes_limit: 20)
group.update!(shared_runners_minutes_limit: 20)
allow_any_instance_of(EE::Namespace).to receive(:shared_runners_remaining_minutes).and_return(remaining_minutes)
end
......
......@@ -9,7 +9,7 @@ RSpec.describe 'Dashboard operations', :js do
project = create(:project, :repository, name: 'Great Project')
pipeline = create(:ci_pipeline, project: project, sha: project.commit.sha, status: :running)
project.add_developer(user)
user.update(ops_dashboard_projects: [project])
user.update!(ops_dashboard_projects: [project])
sign_in(user)
visit operations_path
......@@ -47,7 +47,7 @@ RSpec.describe 'Dashboard operations', :js do
gold_project.add_developer(user)
bronze_group.add_developer(user)
user.update(ops_dashboard_projects: [gold_project, bronze_project, public_project])
user.update!(ops_dashboard_projects: [gold_project, bronze_project, public_project])
sign_in(user)
visit operations_path
......
......@@ -19,7 +19,7 @@ RSpec.describe 'GFM autocomplete EE', :js do
before do
stub_feature_flags(tribute_autocomplete: false)
issue_assignee.update(assignees: [user])
issue_assignee.update!(assignees: [user])
sign_in(user)
visit project_issue_path(project, issue_assignee)
......@@ -48,7 +48,7 @@ RSpec.describe 'GFM autocomplete EE', :js do
before do
stub_feature_flags(tribute_autocomplete: true)
issue_assignee.update(assignees: [user])
issue_assignee.update!(assignees: [user])
sign_in(user)
visit project_issue_path(project, issue_assignee)
......
......@@ -66,7 +66,7 @@ RSpec.xdescribe 'Merge request > User approves', :js do
before do
create :approver_group, group: group, target: merge_request
pipeline = create(:ci_empty_pipeline, project: project, sha: merge_request.diff_head_sha, ref: merge_request.source_branch)
merge_request.update(head_pipeline: pipeline)
merge_request.update!(head_pipeline: pipeline)
visit project_merge_request_path(project, merge_request)
end
......
......@@ -21,13 +21,13 @@ RSpec.describe 'User views all merge requests' do
end
it 'shows custom tooltip after a different user has approved' do
merge_request.approvals.create(user: another_user)
merge_request.approvals.create!(user: another_user)
visit(project_merge_requests_path(project, state: :all))
expect(page.all('li').any? { |item| item["title"] == "Required approvals (1 given)"}).to be true
end
it 'shows custom tooltip after self has approved' do
merge_request.approvals.create(user: user)
merge_request.approvals.create!(user: user)
sign_in(user)
visit(project_merge_requests_path(project, state: :all))
expect(page.all('li').any? { |item| item["title"] == "Required approvals (1 given, you've approved)"}).to be true
......@@ -36,28 +36,28 @@ RSpec.describe 'User views all merge requests' do
it 'shows custom tooltip after user has approved' do
sign_in(user)
merge_request.approvals.create(user: user)
merge_request.approvals.create!(user: user)
visit(project_merge_requests_path(project, state: :all))
expect(page.all('li').any? { |item| item["title"] == "1 approver (you've approved)"}).to be true
end
it 'shows custom tooltip after a different user has approved' do
merge_request.approvals.create(user: another_user)
merge_request.approvals.create!(user: another_user)
sign_in(user)
visit(project_merge_requests_path(project, state: :all))
expect(page.all('li').any? { |item| item["title"] == "1 approver"}).to be true
end
it 'shows custom tooltip after multiple users have approved' do
merge_request.approvals.create(user: another_user)
merge_request.approvals.create(user: user)
merge_request.approvals.create!(user: another_user)
merge_request.approvals.create!(user: user)
visit(project_merge_requests_path(project, state: :all))
expect(page.all('li').any? { |item| item["title"] == "2 approvers"}).to be true
end
it 'shows custom tooltip after multiple users have approved, including self' do
merge_request.approvals.create(user: another_user)
merge_request.approvals.create(user: user)
merge_request.approvals.create!(user: another_user)
merge_request.approvals.create!(user: user)
sign_in(user)
visit(project_merge_requests_path(project, state: :all))
expect(page.all('li').any? { |item| item["title"] == "2 approvers (you've approved)"}).to be true
......
......@@ -99,7 +99,7 @@ RSpec.describe 'Project > Members > Invite group and members', :js do
context 'when the group has membership lock and "Share with group lock" enabled' do
before do
project.namespace.update(share_with_group_lock: true, membership_lock: true)
project.namespace.update!(share_with_group_lock: true, membership_lock: true)
end
it_behaves_like 'the project cannot be shared with groups and members'
......@@ -139,7 +139,7 @@ RSpec.describe 'Project > Members > Invite group and members', :js do
context 'when the group has membership lock and "Share with group lock" enabled' do
before do
subgroup.update(share_with_group_lock: true, membership_lock: true)
subgroup.update!(share_with_group_lock: true, membership_lock: true)
end
it_behaves_like 'the project cannot be shared with groups and members'
......@@ -148,7 +148,7 @@ RSpec.describe 'Project > Members > Invite group and members', :js do
context 'when the root_group has "Share with group lock" and membership lock enabled' do
before do
root_group.update(share_with_group_lock: true, membership_lock: true)
root_group.update!(share_with_group_lock: true, membership_lock: true)
subgroup.reload
end
......@@ -158,7 +158,7 @@ RSpec.describe 'Project > Members > Invite group and members', :js do
context 'when the subgroup has "Share with group lock" and membership lock disabled (parent overridden)' do
before do
subgroup.update(share_with_group_lock: false, membership_lock: false)
subgroup.update!(share_with_group_lock: false, membership_lock: false)
end
it_behaves_like 'the project can be shared with groups and members'
......@@ -184,7 +184,7 @@ RSpec.describe 'Project > Members > Invite group and members', :js do
context 'when the subgroup has "Share with group lock" and membership lock enabled' do
before do
subgroup.update(membership_lock: true, share_with_group_lock: true)
subgroup.update!(membership_lock: true, share_with_group_lock: true)
end
it_behaves_like 'the project cannot be shared with groups and members'
......
......@@ -77,7 +77,7 @@ RSpec.describe 'User approves a merge request', :js do
context 'when user cannot approve' do
before do
merge_request.approvers.create(user_id: user2.id)
merge_request.approvers.create!(user_id: user2.id)
visit(merge_request_path(merge_request))
end
......
......@@ -17,7 +17,7 @@ RSpec.describe 'Project mirror', :js do
context 'when mirror was updated successfully' do
before do
import_state.update(last_successful_update_at: 5.minutes.ago)
import_state.update!(last_successful_update_at: 5.minutes.ago)
end
it 'shows the last successful at timestamp' do
......@@ -31,7 +31,7 @@ RSpec.describe 'Project mirror', :js do
context 'when mirror was never updated successfully' do
before do
import_state.update(last_successful_update_at: nil)
import_state.update!(last_successful_update_at: nil)
end
it 'shows that mirror has never been updated' do
......@@ -47,7 +47,7 @@ RSpec.describe 'Project mirror', :js do
let(:timestamp) { Time.now }
before do
import_state.update(last_update_at: 6.minutes.ago, next_execution_timestamp: timestamp + 10.minutes)
import_state.update!(last_update_at: 6.minutes.ago, next_execution_timestamp: timestamp + 10.minutes)
end
context 'when able to force update' do
......@@ -66,7 +66,7 @@ RSpec.describe 'Project mirror', :js do
context 'when unable to force update' do
before do
import_state.update(next_execution_timestamp: timestamp - 1.minute)
import_state.update!(next_execution_timestamp: timestamp - 1.minute)
end
let(:disabled_updating_button) { '[data-qa-selector="updating_button"].disabled' }
......
......@@ -297,9 +297,9 @@ RSpec.describe 'New project' do
group2.add_owner(user)
group3.add_owner(user)
group4.add_owner(user)
group1.update(custom_project_templates_group_id: subgroup1.id)
group2.update(custom_project_templates_group_id: subgroup2.id)
subgroup4.update(custom_project_templates_group_id: subsubgroup4.id)
group1.update!(custom_project_templates_group_id: subgroup1.id)
group2.update!(custom_project_templates_group_id: subgroup2.id)
subgroup4.update!(custom_project_templates_group_id: subsubgroup4.id)
end
context 'when top level context' do
......
......@@ -13,7 +13,7 @@ RSpec.describe 'EE > Projects > Settings > User manages approval rule settings'
sign_in(user)
stub_licensed_features(licensed_features)
project.project_feature.update(project_features)
project.project_feature.update!(project_features)
visit path
end
......
......@@ -13,7 +13,7 @@ RSpec.describe "User manages members" do
shared_examples "when group membership is unlocked" do
before do
group.update(membership_lock: false)
group.update!(membership_lock: false)
visit(project_project_members_path(project))
end
......@@ -23,7 +23,7 @@ RSpec.describe "User manages members" do
shared_examples "when group membership is locked" do
before do
group.update(membership_lock: true)
group.update!(membership_lock: true)
visit(project_project_members_path(project))
end
......
......@@ -146,7 +146,7 @@ RSpec.describe 'Global elastic search', :elastic, :sidekiq_inline do
ensure_elasticsearch_index!
project_2.destroy
project_2.destroy!
visit dashboard_projects_path
......
......@@ -165,7 +165,7 @@ RSpec.describe '[EE] Internal Project Access' do
context "when allowed for public and internal" do
before do
project.update(public_builds: true)
project.update!(public_builds: true)
end
it { is_expected.to be_allowed_for(:auditor) }
......@@ -173,7 +173,7 @@ RSpec.describe '[EE] Internal Project Access' do
context "when disallowed for public and internal" do
before do
project.update(public_builds: false)
project.update!(public_builds: false)
end
it { is_expected.to be_allowed_for(:auditor) }
......@@ -188,7 +188,7 @@ RSpec.describe '[EE] Internal Project Access' do
context "when allowed for public and internal" do
before do
project.update(public_builds: true)
project.update!(public_builds: true)
end
it { is_expected.to be_allowed_for(:auditor) }
......@@ -196,7 +196,7 @@ RSpec.describe '[EE] Internal Project Access' do
context "when disallowed for public and internal" do
before do
project.update(public_builds: false)
project.update!(public_builds: false)
end
it { is_expected.to be_allowed_for(:auditor) }
......
......@@ -81,7 +81,7 @@ RSpec.describe '[EE] Public Project Access' do
context "when allowed for public" do
before do
project.update(public_builds: true)
project.update!(public_builds: true)
end
it { is_expected.to be_allowed_for(:auditor) }
......@@ -89,7 +89,7 @@ RSpec.describe '[EE] Public Project Access' do
context "when disallowed for public" do
before do
project.update(public_builds: false)
project.update!(public_builds: false)
end
it { is_expected.to be_allowed_for(:auditor) }
......@@ -104,7 +104,7 @@ RSpec.describe '[EE] Public Project Access' do
context "when allowed for public" do
before do
project.update(public_builds: true)
project.update!(public_builds: true)
end
it { is_expected.to be_allowed_for(:auditor) }
......@@ -112,7 +112,7 @@ RSpec.describe '[EE] Public Project Access' do
context "when disallowed for public" do
before do
project.update(public_builds: false)
project.update!(public_builds: false)
end
it { is_expected.to be_allowed_for(:auditor) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment