2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
describe 'Admin::HookLogs' do
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:project) { create(:project) }
|
|
|
|
let(:system_hook) { create(:system_hook) }
|
|
|
|
let(:hook_log) { create(:web_hook_log, web_hook: system_hook, internal_error_message: 'some error') }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(create(:admin))
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'show list of hook logs' do
|
2017-09-10 17:25:29 +05:30
|
|
|
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-11-08 19:23:39 +05:30
|
|
|
it 'show hook log details' do
|
2017-09-10 17:25:29 +05:30
|
|
|
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-11-08 19:23:39 +05:30
|
|
|
it 'retry hook log' do
|
2017-09-10 17:25:29 +05:30
|
|
|
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
|