Commit 4372faae authored by Rémy Coutable's avatar Rémy Coutable

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

Fix Rails/SaveBang offenses in spec/features

See merge request gitlab-org/gitlab!57907
parents 52ab1ffd e45fee4a
......@@ -197,16 +197,10 @@ Rails/SaveBang:
- 'spec/features/admin/admin_sees_project_statistics_spec.rb'
- 'spec/features/admin/admin_sees_projects_statistics_spec.rb'
- 'spec/features/admin/admin_users_impersonation_tokens_spec.rb'
- 'spec/features/boards/sidebar_spec.rb'
- 'spec/features/calendar_spec.rb'
- 'spec/features/commits_spec.rb'
- 'spec/features/dashboard/datetime_on_tooltips_spec.rb'
- 'spec/features/dashboard/issuables_counter_spec.rb'
- 'spec/features/dashboard/project_member_activity_index_spec.rb'
- 'spec/features/dashboard/projects_spec.rb'
- 'spec/features/error_tracking/user_sees_error_index_spec.rb'
- 'spec/features/groups/members/request_access_spec.rb'
- 'spec/features/issuables/close_reopen_report_toggle_spec.rb'
- 'spec/features/issues/bulk_assignment_labels_spec.rb'
- 'spec/features/issues/gfm_autocomplete_spec.rb'
- 'spec/features/issues/issue_sidebar_spec.rb'
......@@ -217,9 +211,6 @@ Rails/SaveBang:
- 'spec/features/issues/user_filters_issues_spec.rb'
- 'spec/features/issues/user_sees_live_update_spec.rb'
- 'spec/features/issues/user_sorts_issues_spec.rb'
- 'spec/features/profiles/emails_spec.rb'
- 'spec/features/profiles/password_spec.rb'
- 'spec/features/profiles/personal_access_tokens_spec.rb'
- 'spec/features/projects/features_visibility_spec.rb'
- 'spec/features/projects/fork_spec.rb'
- 'spec/features/projects/jobs_spec.rb'
......@@ -236,12 +227,6 @@ Rails/SaveBang:
- 'spec/features/projects/wiki/user_updates_wiki_page_spec.rb'
- 'spec/features/projects/wiki/user_views_wiki_page_spec.rb'
- 'spec/features/projects/wiki/users_views_asciidoc_page_with_includes_spec.rb'
- 'spec/features/runners_spec.rb'
- 'spec/features/security/project/internal_access_spec.rb'
- 'spec/features/security/project/private_access_spec.rb'
- 'spec/features/security/project/public_access_spec.rb'
- 'spec/features/users/login_spec.rb'
- 'spec/features/users/show_spec.rb'
- 'spec/frontend/fixtures/issues.rb'
- 'spec/frontend/fixtures/merge_requests.rb'
- 'spec/graphql/mutations/merge_requests/set_locked_spec.rb'
......
---
title: Fix Rails/SaveBang rubocop offenses in spec/features/
merge_request: 57907
author: Abdul Wadood @abdulwd
type: fixed
......@@ -64,7 +64,7 @@ RSpec.describe 'Contributions Calendar', :js do
author_id: user.id
}
Event.create(note_comment_params)
Event.create!(note_comment_params)
end
def selected_day_activities(visible: true)
......
......@@ -140,7 +140,7 @@ RSpec.describe 'Commits' do
context 'when accessing internal project with disallowed access', :js, quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/299575' do
before do
project.update(
project.update!(
visibility_level: Gitlab::VisibilityLevel::INTERNAL,
public_builds: false)
create(:ci_job_artifact, :archive, file: artifacts_file, job: build)
......
......@@ -41,7 +41,7 @@ RSpec.describe 'View error index page', :js, :use_clean_rails_memory_store_cachi
context 'with error tracking settings disabled' do
before do
project_error_tracking_settings.update(enabled: false)
project_error_tracking_settings.update!(enabled: false)
sign_in(project.owner)
visit project_error_tracking_index_path(project)
......
......@@ -15,7 +15,7 @@ RSpec.describe 'Groups > Members > Request access' do
end
it 'request access feature is disabled' do
group.update(request_access_enabled: false)
group.update!(request_access_enabled: false)
visit group_path(group)
expect(page).not_to have_content 'Request Access'
......
......@@ -43,7 +43,7 @@ RSpec.describe 'Profile > Emails' do
end
it 'user removes email' do
user.emails.create(email: 'my@email.com')
user.emails.create!(email: 'my@email.com')
visit profile_emails_path
expect(page).to have_content("my@email.com")
......@@ -52,7 +52,7 @@ RSpec.describe 'Profile > Emails' do
end
it 'user confirms email' do
email = user.emails.create(email: 'my@email.com')
email = user.emails.create!(email: 'my@email.com')
visit profile_emails_path
expect(page).to have_content("#{email.email} Unverified")
......@@ -64,7 +64,7 @@ RSpec.describe 'Profile > Emails' do
end
it 'user re-sends confirmation email' do
email = user.emails.create(email: 'my@email.com')
email = user.emails.create!(email: 'my@email.com')
visit profile_emails_path
expect { click_link("Resend confirmation email") }.to have_enqueued_job.on_queue('mailers')
......@@ -72,7 +72,7 @@ RSpec.describe 'Profile > Emails' do
end
it 'old unconfirmed emails show Send Confirmation button' do
email = user.emails.create(email: 'my@email.com')
email = user.emails.create!(email: 'my@email.com')
email.update_attribute(:confirmation_sent_at, nil)
visit profile_emails_path
......
......@@ -119,7 +119,7 @@ RSpec.describe 'Profile > Password' do
before do
sign_in(user)
user.update(password_expires_at: 1.hour.ago)
user.update!(password_expires_at: 1.hour.ago)
user.identities.delete
expect(user.ldap_user?).to eq false
end
......
......@@ -95,7 +95,7 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do
end
it "removes expired tokens from 'active' section" do
personal_access_token.update(expires_at: 5.days.ago)
personal_access_token.update!(expires_at: 5.days.ago)
visit profile_personal_access_tokens_path
expect(page).to have_selector(".settings-message")
......
......@@ -92,7 +92,7 @@ RSpec.describe 'Runners' do
context 'when a runner has a tag' do
before do
specific_runner.update(tag_list: ['tag'])
specific_runner.update!(tag_list: ['tag'])
end
it 'user edits runner not to run untagged jobs' do
......@@ -370,7 +370,7 @@ RSpec.describe 'Runners' do
context 'when a runner has a tag' do
before do
runner.update(tag_list: ['tag'])
runner.update!(tag_list: ['tag'])
end
it 'user edits runner not to run untagged jobs' do
......@@ -450,7 +450,7 @@ RSpec.describe 'Runners' do
context 'when a runner has a tag' do
before do
runner.update(tag_list: ['tag'])
runner.update!(tag_list: ['tag'])
end
it 'user edits runner not to run untagged jobs' do
......
......@@ -356,7 +356,7 @@ RSpec.describe "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(:admin) }
......@@ -372,7 +372,7 @@ RSpec.describe "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 allowed for admin when admin mode is enabled', :enable_admin_mode) { is_expected.to be_allowed_for(:admin) }
......@@ -396,7 +396,7 @@ RSpec.describe "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(:admin) }
......@@ -412,7 +412,7 @@ RSpec.describe "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 allowed for admin when admin mode is enabled', :enable_admin_mode) { is_expected.to be_allowed_for(:admin) }
......@@ -436,7 +436,7 @@ RSpec.describe "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(:admin) }
......@@ -452,7 +452,7 @@ RSpec.describe "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 allowed for admin when admin mode is enabled', :enable_admin_mode) { is_expected.to be_allowed_for(:admin) }
......
......@@ -319,7 +319,7 @@ RSpec.describe "Private Project Access" do
context 'when public builds is enabled' do
before do
project.update(public_builds: true)
project.update!(public_builds: true)
end
it { is_expected.to be_allowed_for(:guest).of(project) }
......@@ -348,7 +348,7 @@ RSpec.describe "Private Project Access" do
context 'when public builds is enabled' do
before do
project.update(public_builds: true)
project.update!(public_builds: true)
end
it { is_expected.to be_allowed_for(:guest).of(project) }
......@@ -375,7 +375,7 @@ RSpec.describe "Private Project Access" do
context 'when public builds is enabled' do
before do
project.update(public_builds: true)
project.update!(public_builds: true)
end
it { is_expected.to be_allowed_for(:guest).of(project) }
......@@ -405,7 +405,7 @@ RSpec.describe "Private Project Access" do
context 'when public builds is enabled' do
before do
project.update(public_builds: true)
project.update!(public_builds: true)
end
it { is_expected.to be_allowed_for(:guest).of(project) }
......@@ -414,7 +414,7 @@ RSpec.describe "Private Project Access" do
context 'when public buils are disabled' do
before do
project.public_builds = false
project.save
project.save!
end
it { is_expected.to be_denied_for(:guest).of(project) }
......@@ -440,7 +440,7 @@ RSpec.describe "Private Project Access" do
context 'when public builds is enabled' do
before do
project.update(public_builds: true)
project.update!(public_builds: true)
end
it { is_expected.to be_allowed_for(:guest).of(project) }
......@@ -448,7 +448,7 @@ RSpec.describe "Private Project Access" do
context 'when public builds is disabled' do
before do
project.update(public_builds: false)
project.update!(public_builds: false)
end
it { is_expected.to be_denied_for(:guest).of(project) }
......
......@@ -164,7 +164,7 @@ RSpec.describe "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(:admin) }
......@@ -180,7 +180,7 @@ RSpec.describe "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 allowed for admin when admin mode is enabled', :enable_admin_mode) { is_expected.to be_allowed_for(:admin) }
......@@ -204,7 +204,7 @@ RSpec.describe "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(:admin) }
......@@ -220,7 +220,7 @@ RSpec.describe "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 allowed for admin when admin mode is enabled', :enable_admin_mode) { is_expected.to be_allowed_for(:admin) }
......@@ -244,7 +244,7 @@ RSpec.describe "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(:admin) }
......@@ -260,7 +260,7 @@ RSpec.describe "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 allowed for admin when admin mode is enabled', :enable_admin_mode) { is_expected.to be_allowed_for(:admin) }
......
......@@ -239,7 +239,7 @@ RSpec.describe 'Login' do
expect(codes.size).to eq 10
# Ensure the generated codes get saved
user.save(touch: false)
user.save!(touch: false)
end
context 'with valid code' do
......
......@@ -33,7 +33,7 @@ RSpec.describe 'User page' do
context 'work information' do
it 'shows job title and organization details' do
user.update(organization: 'GitLab - work info test', job_title: 'Frontend Engineer')
user.update!(organization: 'GitLab - work info test', job_title: 'Frontend Engineer')
subject
......@@ -41,7 +41,7 @@ RSpec.describe 'User page' do
end
it 'shows job title' do
user.update(organization: nil, job_title: 'Frontend Engineer - work info test')
user.update!(organization: nil, job_title: 'Frontend Engineer - work info test')
subject
......@@ -49,7 +49,7 @@ RSpec.describe 'User page' do
end
it 'shows organization details' do
user.update(organization: 'GitLab - work info test', job_title: '')
user.update!(organization: 'GitLab - work info test', job_title: '')
subject
......
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