Commit 2c996a3d authored by Abdul Wadood's avatar Abdul Wadood

Fix Rails/SaveBang offenses for profile & projects controllers

Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/220040.
parent 66e5e658
...@@ -178,9 +178,6 @@ Rails/SaveBang: ...@@ -178,9 +178,6 @@ Rails/SaveBang:
- 'spec/controllers/groups/runners_controller_spec.rb' - 'spec/controllers/groups/runners_controller_spec.rb'
- 'spec/controllers/groups/uploads_controller_spec.rb' - 'spec/controllers/groups/uploads_controller_spec.rb'
- 'spec/controllers/groups_controller_spec.rb' - 'spec/controllers/groups_controller_spec.rb'
- 'spec/controllers/profiles/emails_controller_spec.rb'
- 'spec/controllers/profiles/notifications_controller_spec.rb'
- 'spec/controllers/projects_controller_spec.rb'
- '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'
......
...@@ -5,8 +5,8 @@ require 'spec_helper' ...@@ -5,8 +5,8 @@ require 'spec_helper'
RSpec.describe Profiles::NotificationsController do RSpec.describe Profiles::NotificationsController do
let(:user) do let(:user) do
create(:user) do |user| create(:user) do |user|
user.emails.create(email: 'original@example.com', confirmed_at: Time.current) user.emails.create!(email: 'original@example.com', confirmed_at: Time.current)
user.emails.create(email: 'new@example.com', confirmed_at: Time.current) user.emails.create!(email: 'new@example.com', confirmed_at: Time.current)
user.notification_email = 'original@example.com' user.notification_email = 'original@example.com'
user.save! user.save!
end end
......
...@@ -159,7 +159,7 @@ RSpec.describe ProjectsController do ...@@ -159,7 +159,7 @@ RSpec.describe ProjectsController do
before do before do
setting = user.notification_settings_for(public_project) setting = user.notification_settings_for(public_project)
setting.level = :watch setting.level = :watch
setting.save setting.save!
end end
it "shows current notification setting" do it "shows current notification setting" do
...@@ -237,7 +237,7 @@ RSpec.describe ProjectsController do ...@@ -237,7 +237,7 @@ RSpec.describe ProjectsController do
User.project_views.keys.each do |project_view| User.project_views.keys.each do |project_view|
context "with #{project_view} view set" do context "with #{project_view} view set" do
before do before do
user.update(project_view: project_view) user.update!(project_view: project_view)
get :show, params: { namespace_id: empty_project.namespace, id: empty_project } get :show, params: { namespace_id: empty_project.namespace, id: empty_project }
end end
...@@ -260,7 +260,7 @@ RSpec.describe ProjectsController do ...@@ -260,7 +260,7 @@ RSpec.describe ProjectsController do
User.project_views.keys.each do |project_view| User.project_views.keys.each do |project_view|
context "with #{project_view} view set" do context "with #{project_view} view set" do
before do before do
user.update(project_view: project_view) user.update!(project_view: project_view)
get :show, params: { namespace_id: empty_project.namespace, id: empty_project } get :show, params: { namespace_id: empty_project.namespace, id: empty_project }
end end
......
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