diff options
Diffstat (limited to 'spec/models/hooks/web_hook_spec.rb')
-rw-r--r-- | spec/models/hooks/web_hook_spec.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/models/hooks/web_hook_spec.rb b/spec/models/hooks/web_hook_spec.rb index fe08dc4f5e6..025c11d6407 100644 --- a/spec/models/hooks/web_hook_spec.rb +++ b/spec/models/hooks/web_hook_spec.rb @@ -6,7 +6,7 @@ describe WebHook do let(:hook) { build(:project_hook) } describe 'associations' do - it { is_expected.to have_many(:web_hook_logs).dependent(:destroy) } + it { is_expected.to have_many(:web_hook_logs) } end describe 'validations' do @@ -85,4 +85,13 @@ describe WebHook do hook.async_execute(data, hook_name) end end + + describe '#destroy' do + it 'cascades to web_hook_logs' 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) + end + end end |