Commit 414ae28d authored by Huzaifa Iftikhar's avatar Huzaifa Iftikhar

Fix Rails/SaveBang Rubocop offenses for hooks models

parent fffdd5c4
...@@ -349,8 +349,6 @@ Rails/SaveBang: ...@@ -349,8 +349,6 @@ Rails/SaveBang:
- 'spec/models/generic_commit_status_spec.rb' - 'spec/models/generic_commit_status_spec.rb'
- 'spec/models/grafana_integration_spec.rb' - 'spec/models/grafana_integration_spec.rb'
- 'spec/models/group_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/identity_spec.rb'
- 'spec/models/issue/metrics_spec.rb' - 'spec/models/issue/metrics_spec.rb'
- 'spec/models/issue_spec.rb' - 'spec/models/issue_spec.rb'
......
...@@ -56,7 +56,7 @@ RSpec.describe SystemHook do ...@@ -56,7 +56,7 @@ RSpec.describe SystemHook do
end end
it "user_destroy hook" do it "user_destroy hook" do
user.destroy user.destroy!
expect(WebMock).to have_requested(:post, system_hook.url).with( expect(WebMock).to have_requested(:post, system_hook.url).with(
body: /user_destroy/, body: /user_destroy/,
...@@ -102,7 +102,7 @@ RSpec.describe SystemHook do ...@@ -102,7 +102,7 @@ RSpec.describe SystemHook do
end end
it 'group destroy hook' do it 'group destroy hook' do
group.destroy group.destroy!
expect(WebMock).to have_requested(:post, system_hook.url).with( expect(WebMock).to have_requested(:post, system_hook.url).with(
body: /group_destroy/, body: /group_destroy/,
......
...@@ -26,7 +26,7 @@ RSpec.describe WebHook do ...@@ -26,7 +26,7 @@ RSpec.describe WebHook do
it 'strips :url before saving it' do it 'strips :url before saving it' do
hook.url = ' https://example.com ' hook.url = ' https://example.com '
hook.save hook.save!
expect(hook.url).to eq('https://example.com') expect(hook.url).to eq('https://example.com')
end end
...@@ -45,14 +45,14 @@ RSpec.describe WebHook do ...@@ -45,14 +45,14 @@ RSpec.describe WebHook do
it 'gets rid of whitespace' do it 'gets rid of whitespace' do
hook.push_events_branch_filter = ' branch ' hook.push_events_branch_filter = ' branch '
hook.save hook.save!
expect(hook.push_events_branch_filter).to eq('branch') expect(hook.push_events_branch_filter).to eq('branch')
end end
it 'stores whitespace only as empty' do it 'stores whitespace only as empty' do
hook.push_events_branch_filter = ' ' hook.push_events_branch_filter = ' '
hook.save hook.save!
expect(hook.push_events_branch_filter).to eq('') expect(hook.push_events_branch_filter).to eq('')
end end
...@@ -91,7 +91,7 @@ RSpec.describe WebHook do ...@@ -91,7 +91,7 @@ RSpec.describe WebHook do
web_hook = create(:project_hook) web_hook = create(:project_hook)
create_list(:web_hook_log, 3, web_hook: web_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 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