Commit 07896a07 authored by Michael Kozono's avatar Michael Kozono

Merge branch 'issue#220040-fix-rails-savebang-hooks-models' into 'master'

Fix Rails/SaveBang Rubocop offenses for hooks models

See merge request gitlab-org/gitlab!57918
parents 77236456 6b36101d
......@@ -300,8 +300,6 @@ Rails/SaveBang:
- 'spec/models/generic_commit_status_spec.rb'
- 'spec/models/grafana_integration_spec.rb'
- 'spec/models/group_spec.rb'
- 'spec/models/hooks/system_hook_spec.rb'
- 'spec/models/hooks/web_hook_spec.rb'
- 'spec/models/identity_spec.rb'
- 'spec/models/issue/metrics_spec.rb'
- 'spec/models/issue_spec.rb'
......
---
title: Fix Rails/SaveBang Rubocop offenses for hooks module
merge_request: 57918
author: Huzaifa Iftikhar @huzaifaiftikhar
type: fixed
......@@ -56,7 +56,7 @@ RSpec.describe SystemHook do
end
it "user_destroy hook" do
user.destroy
user.destroy!
expect(WebMock).to have_requested(:post, system_hook.url).with(
body: /user_destroy/,
......@@ -102,7 +102,7 @@ RSpec.describe SystemHook do
end
it 'group destroy hook' do
group.destroy
group.destroy!
expect(WebMock).to have_requested(:post, system_hook.url).with(
body: /group_destroy/,
......
......@@ -26,7 +26,7 @@ RSpec.describe WebHook do
it 'strips :url before saving it' do
hook.url = ' https://example.com '
hook.save
hook.save!
expect(hook.url).to eq('https://example.com')
end
......@@ -45,14 +45,14 @@ RSpec.describe WebHook do
it 'gets rid of whitespace' do
hook.push_events_branch_filter = ' branch '
hook.save
hook.save!
expect(hook.push_events_branch_filter).to eq('branch')
end
it 'stores whitespace only as empty' do
hook.push_events_branch_filter = ' '
hook.save
hook.save!
expect(hook.push_events_branch_filter).to eq('')
end
......@@ -91,7 +91,7 @@ RSpec.describe WebHook do
web_hook = create(:project_hook)
create_list(:web_hook_log, 3, web_hook: web_hook)
expect { web_hook.destroy }.to change(web_hook.web_hook_logs, :count).by(-3)
expect { web_hook.destroy! }.to change(web_hook.web_hook_logs, :count).by(-3)
end
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