diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 15:08:15 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 15:08:15 +0000 |
commit | c2b98d3dbd47ab92c79c702276fe9130d9a28036 (patch) | |
tree | bf4071f551fdc12c22b23b2bb66483064e7b9ea9 /spec/controllers/projects/service_hook_logs_controller_spec.rb | |
parent | badb9c1deacbea601b02f88811b7e123589d9251 (diff) | |
download | gitlab-ce-c2b98d3dbd47ab92c79c702276fe9130d9a28036.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/projects/service_hook_logs_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/service_hook_logs_controller_spec.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/controllers/projects/service_hook_logs_controller_spec.rb b/spec/controllers/projects/service_hook_logs_controller_spec.rb new file mode 100644 index 00000000000..ca57b0579a8 --- /dev/null +++ b/spec/controllers/projects/service_hook_logs_controller_spec.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Projects::ServiceHookLogsController do + let(:project) { create(:project, :repository) } + let(:user) { create(:user) } + let(:service) { create(:drone_ci_service, project: project) } + let(:log) { create(:web_hook_log, web_hook: service.service_hook) } + let(:log_params) do + { + namespace_id: project.namespace, + project_id: project, + service_id: service.to_param, + id: log.id + } + end + + before do + sign_in(user) + project.add_maintainer(user) + end + + describe 'GET #show' do + subject { get :show, params: log_params } + + it do + expect(response).to be_successful + end + end + + describe 'POST #retry' do + subject { post :retry, params: log_params } + + it 'executes the hook and redirects to the service form' do + expect_any_instance_of(ServiceHook).to receive(:execute) + expect_any_instance_of(described_class).to receive(:set_hook_execution_notice) + expect(subject).to redirect_to(edit_project_service_path(project, service)) + end + end +end |