diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-02-06 17:56:45 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-02-06 17:56:45 +0000 |
commit | ec2806f1f2ad10b7ec68b1835c54c11915387a6a (patch) | |
tree | 4e4b41b2442b6e9eb30d87d5c2ef2f5b29e9fd6c | |
parent | e102be67bb648ebe265d7d7a1c91a491f9048213 (diff) | |
parent | d0dc169b3b34523233fe2586de0277def0ec1f67 (diff) | |
download | gitlab-shell-ec2806f1f2ad10b7ec68b1835c54c11915387a6a.tar.gz |
Merge branch 'print-new-project-in-post-receive' into 'master'v6.0.3
Print new project information in post receive
See merge request gitlab-org/gitlab-shell!186
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | lib/gitlab_post_receive.rb | 1 | ||||
-rw-r--r-- | spec/gitlab_post_receive_spec.rb | 45 |
4 files changed, 31 insertions, 20 deletions
@@ -1,3 +1,6 @@ +v6.0.3 + - Print new project information in post-receive + v6.0.2 - Use grpc-go 1.9.1 (!184) - Update gitaly-proto and gitaly libs (!185) @@ -1 +1 @@ -6.0.2 +6.0.3 diff --git a/lib/gitlab_post_receive.rb b/lib/gitlab_post_receive.rb index 3f411a0..55b00bb 100644 --- a/lib/gitlab_post_receive.rb +++ b/lib/gitlab_post_receive.rb @@ -27,6 +27,7 @@ class GitlabPostReceive print_broadcast_message(response['broadcast_message']) if response['broadcast_message'] print_merge_request_links(response['merge_request_urls']) if response['merge_request_urls'] puts response['redirected_message'] if response['redirected_message'] + puts response['project_created_message'] if response['project_created_message'] response['reference_counter_decreased'] rescue GitlabNet::ApiUnreachableError diff --git a/spec/gitlab_post_receive_spec.rb b/spec/gitlab_post_receive_spec.rb index 1b43db0..ec7e248 100644 --- a/spec/gitlab_post_receive_spec.rb +++ b/spec/gitlab_post_receive_spec.rb @@ -62,20 +62,12 @@ describe GitlabPostReceive do end context 'when redirected message available' do - let(:message) do - <<-MSG - Project 'foo/bar' was moved to 'foo/baz'. - - Please update your Git remote: - - git remote set-url origin http://localhost:3000/foo/baz.git - MSG - end + let(:message) { "This is a redirected message" } let(:response) do - { + { 'reference_counter_decreased' => true, 'redirected_message' => message - } + } end it 'prints redirected message' do @@ -83,6 +75,24 @@ describe GitlabPostReceive do assert_redirected_message_printed(gitlab_post_receive) expect(gitlab_post_receive.exec).to eq(true) end + + context 'when project created message is available' do + let(:message) { "This is a created project message" } + let(:response) do + { + 'reference_counter_decreased' => true, + 'project_created_message' => message + } + end + + it 'prints project created message' do + expect_any_instance_of(GitlabNet).to receive(:post_receive).and_return(response) + + assert_project_created_message_printed(gitlab_post_receive) + + expect(gitlab_post_receive.exec).to be true + end + end end end @@ -129,15 +139,12 @@ describe GitlabPostReceive do "========================================================================" ).ordered end - - def assert_redirected_message_printed(gitlab_post_receive) - message = <<-MSG - Project 'foo/bar' was moved to 'foo/baz'. - Please update your Git remote: + def assert_redirected_message_printed(gitlab_post_receive) + expect(gitlab_post_receive).to receive(:puts).with("This is a redirected message") + end - git remote set-url origin http://localhost:3000/foo/baz.git - MSG - expect(gitlab_post_receive).to receive(:puts).with(message).ordered + def assert_project_created_message_printed(gitlab_post_receive) + expect(gitlab_post_receive).to receive(:puts).with("This is a created project message") end end |