summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsh McKenzie <amckenzie@gitlab.com>2019-10-18 14:30:51 +1100
committerAsh McKenzie <amckenzie@gitlab.com>2019-10-23 16:25:15 +1100
commit3037916365d2f68f572f3515aebce9e7c8d2e72d (patch)
treece8766c0d3c61d6e742a46eb920d386f51be3a30
parent37458a1078d6393ab8da9ba10b12cc8dfe072691 (diff)
downloadgitlab-shell-ashmckenzie/make-console-messages-consistent.tar.gz
More consistent console messages (Ruby)ashmckenzie/make-console-messages-consistent
-rw-r--r--spec/gitlab_shell_custom_git_receive_pack_spec.rb26
-rw-r--r--spec/gitlab_shell_lfs_authentication_spec.rb3
2 files changed, 20 insertions, 9 deletions
diff --git a/spec/gitlab_shell_custom_git_receive_pack_spec.rb b/spec/gitlab_shell_custom_git_receive_pack_spec.rb
index 0a57903..4b0fec4 100644
--- a/spec/gitlab_shell_custom_git_receive_pack_spec.rb
+++ b/spec/gitlab_shell_custom_git_receive_pack_spec.rb
@@ -8,6 +8,7 @@ describe 'Custom bin/gitlab-shell git-receive-pack' do
include_context 'gitlab shell'
let(:env) { {'SSH_CONNECTION' => 'fake', 'SSH_ORIGINAL_COMMAND' => 'git-receive-pack group/repo' } }
+ let(:divider) { "remote: ========================================================================\n" }
before(:context) do
write_config("gitlab_url" => "http+unix://#{CGI.escape(tmp_socket_path)}")
@@ -65,21 +66,24 @@ describe 'Custom bin/gitlab-shell git-receive-pack' do
end
describe 'dialog for performing a custom action' do
- let(:inaccessible_error) { "Internal API error (403)\n" }
-
context 'when API calls perform successfully' do
+ let(:remote_blank_line) { "remote: \n" }
def verify_successful_call!(cmd)
Open3.popen3(env, cmd) do |stdin, stdout, stderr|
- expect(stderr.gets).to eq("> GitLab: console\n")
- expect(stderr.gets).to eq("> GitLab: message\n")
+ expect(stderr.gets).to eq(remote_blank_line)
+ expect(stderr.gets).to eq("remote: console\n")
+ expect(stderr.gets).to eq("remote: message\n")
+ expect(stderr.gets).to eq(remote_blank_line)
- expect(stderr.gets).to eq("> GitLab: info_message\n")
- expect(stderr.gets).to eq("> GitLab: another_message\n")
- expect(stdout.gets(6)).to eq("custom")
+ expect(stderr.gets).to eq(remote_blank_line)
+ expect(stderr.gets).to eq("remote: info_message\n")
+ expect(stderr.gets).to eq("remote: another_message\n")
+ expect(stderr.gets).to eq(remote_blank_line)
stdin.puts("input")
stdin.close
+ expect(stdout.gets(6)).to eq("custom")
expect(stdout.flush.read).to eq("input\n")
end
end
@@ -106,7 +110,13 @@ describe 'Custom bin/gitlab-shell git-receive-pack' do
it 'custom action is not performed' do
Open3.popen2e(env, cmd) do |stdin, stdout|
- expect(stdout.gets).to eq(inaccessible_error)
+ expect(stdout.gets).to eq("remote: \n")
+ expect(stdout.gets).to eq(divider)
+ expect(stdout.gets).to eq("remote: \n")
+ expect(stdout.gets).to eq("remote: Internal API error (403)\n")
+ expect(stdout.gets).to eq("remote: \n")
+ expect(stdout.gets).to eq(divider)
+ expect(stdout.gets).to eq("remote: \n")
end
end
end
diff --git a/spec/gitlab_shell_lfs_authentication_spec.rb b/spec/gitlab_shell_lfs_authentication_spec.rb
index d27f50a..437005c 100644
--- a/spec/gitlab_shell_lfs_authentication_spec.rb
+++ b/spec/gitlab_shell_lfs_authentication_spec.rb
@@ -117,9 +117,10 @@ describe 'bin/gitlab-shell git-lfs-authentication' do
let(:env) { {'SSH_CONNECTION' => 'fake', 'SSH_ORIGINAL_COMMAND' => 'git-lfs-authenticate project/repo unknown' } }
it 'the command is disallowed' do
+ divider = "remote: \nremote: ========================================================================\nremote: \n"
_, stderr, status = Open3.capture3(env, cmd)
- expect(stderr).to eq("> GitLab: Disallowed command\n")
+ expect(stderr).to eq("#{divider}remote: Disallowed command\n#{divider}")
expect(status).not_to be_success
end
end