diff options
Diffstat (limited to 'spec/models/hooks/web_hook_log_spec.rb')
-rw-r--r-- | spec/models/hooks/web_hook_log_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/hooks/web_hook_log_spec.rb b/spec/models/hooks/web_hook_log_spec.rb index 4b88b3b3e65..fd811d4845e 100644 --- a/spec/models/hooks/web_hook_log_spec.rb +++ b/spec/models/hooks/web_hook_log_spec.rb @@ -235,4 +235,28 @@ RSpec.describe WebHookLog, feature_category: :webhooks do it { expect(web_hook_log.request_headers).to eq(expected_headers) } end end + + describe '#url_current?' do + let(:url) { 'example@gitlab.com' } + + let(:hook) { build(:project_hook, url: url) } + let(:web_hook_log) do + build( + :web_hook_log, + web_hook: hook, + interpolated_url: hook.url, + url_hash: Gitlab::CryptoHelper.sha256('example@gitlab.com') + ) + end + + context 'with matching url' do + it { expect(web_hook_log.url_current?).to be_truthy } + end + + context 'with different url' do + let(:url) { 'example@gitlab2.com' } + + it { expect(web_hook_log.url_current?).to be_falsey } + end + end end |