Commit efcfb019 authored by Abdul Wadood's avatar Abdul Wadood

Fix Rails/SaveBang offenses in spec/features/admin

Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/220040.
parent 66e5e658
......@@ -184,13 +184,6 @@ Rails/SaveBang:
- 'spec/controllers/sent_notifications_controller_spec.rb'
- 'spec/controllers/sessions_controller_spec.rb'
- 'spec/factories_spec.rb'
- 'spec/features/admin/admin_appearance_spec.rb'
- 'spec/features/admin/admin_labels_spec.rb'
- 'spec/features/admin/admin_mode/login_spec.rb'
- 'spec/features/admin/admin_runners_spec.rb'
- '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/dashboard/datetime_on_tooltips_spec.rb'
- 'spec/features/dashboard/issuables_counter_spec.rb'
- 'spec/features/dashboard/project_member_activity_index_spec.rb'
......
......@@ -66,7 +66,7 @@ RSpec.describe 'Admin Appearance' do
context 'when system header and footer messages are not empty' do
before do
appearance.update(header_message: 'Foo', footer_message: 'Bar')
appearance.update!(header_message: 'Foo', footer_message: 'Bar')
end
it 'shows custom system header and footer fields' do
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
RSpec.describe 'admin issues labels' do
let!(:bug_label) { Label.create(title: 'bug', template: true) }
let!(:feature_label) { Label.create(title: 'feature', template: true) }
let!(:bug_label) { Label.create!(title: 'bug', template: true) }
let!(:feature_label) { Label.create!(title: 'feature', template: true) }
before do
admin = create(:admin)
......
......@@ -86,7 +86,7 @@ RSpec.describe 'Admin Mode Login' do
expect(codes.size).to eq 10
# Ensure the generated codes get saved
user.save
user.save!
end
context 'with valid code' do
......
......@@ -355,7 +355,7 @@ RSpec.describe "Admin Runners" do
let(:runner) { create(:ci_runner, :instance) }
before do
@project1.destroy
@project1.destroy!
visit admin_runner_path(runner)
end
......
......@@ -21,7 +21,7 @@ RSpec.describe "Admin > Admin sees project statistics" do
end
context 'when project has no statistics' do
let(:project) { create(:project, :repository) { |project| project.statistics.destroy } }
let(:project) { create(:project, :repository) { |project| project.statistics.destroy! } }
it "shows 'Storage: Unknown'" do
expect(page).to have_content("Storage: Unknown")
......
......@@ -7,7 +7,7 @@ RSpec.describe "Admin > Admin sees projects statistics" do
before do
create(:project, :repository)
create(:project, :repository) { |project| project.statistics.destroy }
create(:project, :repository) { |project| project.statistics.destroy! }
sign_in(current_user)
gitlab_enable_admin_mode_sign_in(current_user)
......
......@@ -75,7 +75,7 @@ RSpec.describe 'Admin > Users > Impersonation Tokens', :js do
end
it "removes expired tokens from 'active' section" do
impersonation_token.update(expires_at: 5.days.ago)
impersonation_token.update!(expires_at: 5.days.ago)
visit admin_user_impersonation_tokens_path(user_id: user.username)
......
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