BigW Consortium Gitlab

admin_hook_logs_spec.rb 1.05 KB
Newer Older
1 2
require 'spec_helper'

3
feature 'Admin::HookLogs' do
4
  let(:project) { create(:project) }
5 6 7 8
  let(:system_hook) { create(:system_hook) }
  let(:hook_log) { create(:web_hook_log, web_hook: system_hook, internal_error_message: 'some error') }

  before do
9
    sign_in(create(:admin))
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
  end

  scenario 'show list of hook logs' do
    hook_log
    visit edit_admin_hook_path(system_hook)

    expect(page).to have_content('Recent Deliveries')
    expect(page).to have_content(hook_log.url)
  end

  scenario 'show hook log details' do
    hook_log
    visit edit_admin_hook_path(system_hook)
    click_link 'View details'

    expect(page).to have_content("POST #{hook_log.url}")
    expect(page).to have_content(hook_log.internal_error_message)
    expect(page).to have_content('Resend Request')
  end

  scenario 'retry hook log' do
    WebMock.stub_request(:post, system_hook.url)

    hook_log
    visit edit_admin_hook_path(system_hook)
    click_link 'View details'
    click_link 'Resend Request'

    expect(current_path).to eq(edit_admin_hook_path(system_hook))
  end
end