diff options
| author | Douwe Maan <douwe@gitlab.com> | 2017-12-07 17:27:46 +0000 |
|---|---|---|
| committer | Douwe Maan <douwe@gitlab.com> | 2017-12-07 17:27:46 +0000 |
| commit | cbfddd287c28e4405496de86a0903b0c32e8fd50 (patch) | |
| tree | 430efdc0151e1b0f41ab448d58d9f2761427e03c /spec | |
| parent | 67c822342fae6b9dd299371a8c118ec13f9547fb (diff) | |
| parent | ac8bbb9503165c9483cbd02a36c46310eb02af90 (diff) | |
| download | gitlab-shell-cbfddd287c28e4405496de86a0903b0c32e8fd50.tar.gz | |
Merge branch '35385-allow-git-pull-push-on-project-redirects' into 'master'
Prints a message if project was renamed
See merge request gitlab-org/gitlab-shell!175
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/gitlab_post_receive_spec.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/gitlab_post_receive_spec.rb b/spec/gitlab_post_receive_spec.rb index 82a0f8c..599dd1d 100644 --- a/spec/gitlab_post_receive_spec.rb +++ b/spec/gitlab_post_receive_spec.rb @@ -206,6 +206,30 @@ describe GitlabPostReceive do expect(gitlab_post_receive.exec).to eq(true) end 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(:response) do + { + 'reference_counter_decreased' => true, + 'redirected_message' => message + } + end + + it 'prints redirected message' do + expect_any_instance_of(GitlabNet).to receive(:post_receive).and_return(response) + assert_redirected_message_printed(gitlab_post_receive) + expect(gitlab_post_receive.exec).to eq(true) + end + end end end @@ -252,4 +276,15 @@ 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: + + git remote set-url origin http://localhost:3000/foo/baz.git + MSG + expect(gitlab_post_receive).to receive(:puts).with(message).ordered + end end |
