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