Welcome to mirror list, hosted at ThFree Co, Russian Federation.

integrations_hook_log_actions_shared_examples.rb « web_hooks « concerns « controllers « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 56a5dcb10b21efa68e2453e4d0c16579046f9e17 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# frozen_string_literal: true

RSpec.shared_examples WebHooks::HookLogActions do
  let!(:show_path) { web_hook_log.present.details_path }
  let!(:retry_path) { web_hook_log.present.retry_path }

  before do
    sign_in(user)
  end

  describe 'GET #show' do
    it 'renders a 200 if the hook exists' do
      get show_path

      expect(response).to have_gitlab_http_status(:ok)
      expect(response).to render_template('hook_logs/show')
    end

    it 'renders a 404 if the hook does not exist' do
      web_hook.destroy!
      get show_path

      expect(response).to have_gitlab_http_status(:not_found)
    end
  end

  describe 'POST #retry' do
    it 'executes the hook and redirects to the service form' do
      stub_request(:post, web_hook.interpolated_url)

      expect_next_found_instance_of(web_hook.class) do |hook|
        expect(hook).to receive(:execute).and_call_original
      end

      post retry_path

      expect(response).to redirect_to(edit_hook_path)
    end

    it 'renders a 404 if the hook does not exist' do
      web_hook.destroy!
      post retry_path

      expect(response).to have_gitlab_http_status(:not_found)
    end
  end
end