File: web_hook_log_presenter_spec.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (47 lines) | stat: -rw-r--r-- 1,528 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe WebHookLogPresenter do
  include Gitlab::Routing.url_helpers

  describe '#details_path' do
    let(:web_hook_log) { create(:web_hook_log, web_hook: web_hook) }
    let(:project) { create(:project) }

    subject { web_hook_log.present.details_path }

    context 'project hook' do
      let(:web_hook) { create(:project_hook, project: project) }

      it { is_expected.to eq(project_hook_hook_log_path(project, web_hook, web_hook_log)) }
    end

    context 'service hook' do
      let(:web_hook) { create(:service_hook, integration: integration) }
      let(:integration) { create(:drone_ci_integration, project: project) }

      it { is_expected.to eq(project_settings_integration_hook_log_path(project, integration, web_hook_log)) }
    end
  end

  describe '#retry_path' do
    let(:web_hook_log) { create(:web_hook_log, web_hook: web_hook) }
    let(:project) { create(:project) }

    subject { web_hook_log.present.retry_path }

    context 'project hook' do
      let(:web_hook) { create(:project_hook, project: project) }

      it { is_expected.to eq(retry_project_hook_hook_log_path(project, web_hook, web_hook_log)) }
    end

    context 'service hook' do
      let(:web_hook) { create(:service_hook, integration: integration) }
      let(:integration) { create(:drone_ci_integration, project: project) }

      it { is_expected.to eq(retry_project_settings_integration_hook_log_path(project, integration, web_hook_log)) }
    end
  end
end