2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-27 06:08:57 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
describe 'Admin::HookLogs' do
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project) }
|
2017-04-27 06:08:57 -04:00
|
|
|
let(:system_hook) { create(:system_hook) }
|
|
|
|
let(:hook_log) { create(:web_hook_log, web_hook: system_hook, internal_error_message: 'some error') }
|
|
|
|
|
|
|
|
before do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(create(:admin))
|
2017-04-27 06:08:57 -04:00
|
|
|
end
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'show list of hook logs' do
|
2017-04-27 06:08:57 -04:00
|
|
|
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
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'show hook log details' do
|
2017-04-27 06:08:57 -04:00
|
|
|
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
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'retry hook log' do
|
2017-04-27 06:08:57 -04:00
|
|
|
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
|