summaryrefslogtreecommitdiff
path: root/spec/presenters/service_hook_presenter_spec.rb
blob: 25ded17fb349ffa61e7171a3b529772bf7e61019 (plain)
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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe ServiceHookPresenter do
  let(:web_hook_log) { create(:web_hook_log, web_hook: service_hook) }
  let(:service_hook) { create(:service_hook, integration: integration) }
  let(:integration) { create(:drone_ci_integration, project: project) }
  let(:project) { create(:project) }

  describe '#logs_details_path' do
    subject { service_hook.present.logs_details_path(web_hook_log) }

    let(:expected_path) do
      "/#{project.namespace.path}/#{project.name}/-/integrations/#{integration.to_param}/hook_logs/#{web_hook_log.id}"
    end

    it { is_expected.to eq(expected_path) }
  end

  describe '#logs_retry_path' do
    subject { service_hook.present.logs_retry_path(web_hook_log) }

    let(:expected_path) do
      "/#{project.namespace.path}/#{project.name}/-/integrations/#{integration.to_param}/hook_logs/#{web_hook_log.id}/retry"
    end

    it { is_expected.to eq(expected_path) }
  end
end