diff options
author | Luke Duncalfe <lduncalfe@eml.cc> | 2019-04-01 10:20:21 +1300 |
---|---|---|
committer | Luke Duncalfe <lduncalfe@eml.cc> | 2019-04-01 10:20:21 +1300 |
commit | 84d96bed60f6ffd7a1bc81f0c99ad7ff3296ef95 (patch) | |
tree | f5db3e0c8624d021ba98082f5255e0cef51102ec | |
parent | c5eb9428cdae7d3aa17427c8285317d179b92873 (diff) | |
download | gitlab-shell-84d96bed60f6ffd7a1bc81f0c99ad7ff3296ef95.tar.gz |
Rename print_broadbast method to be genericdisplay-post-receive-warnings
print_warnings is now using that method in order to print a large
formatted warning message, so renaming the method to be less tied to
the broadcast message functionality.
-rw-r--r-- | lib/gitlab_post_receive.rb | 6 | ||||
-rw-r--r-- | spec/gitlab_post_receive_spec.rb | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/gitlab_post_receive.rb b/lib/gitlab_post_receive.rb index f0ff25b..7c5bd19 100644 --- a/lib/gitlab_post_receive.rb +++ b/lib/gitlab_post_receive.rb @@ -24,7 +24,7 @@ class GitlabPostReceive end return false unless response - print_broadcast_message(response['broadcast_message']) if response['broadcast_message'] + print_formatted_alert_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'] @@ -62,10 +62,10 @@ class GitlabPostReceive def print_warnings(warnings) message = "WARNINGS:\n#{warnings}" - print_broadcast_message(message) + print_formatted_alert_message(message) end - def print_broadcast_message(message) + def print_formatted_alert_message(message) # A standard terminal window is (at least) 80 characters wide. total_width = 80 diff --git a/spec/gitlab_post_receive_spec.rb b/spec/gitlab_post_receive_spec.rb index a9b5340..d061830 100644 --- a/spec/gitlab_post_receive_spec.rb +++ b/spec/gitlab_post_receive_spec.rb @@ -108,7 +108,7 @@ describe GitlabPostReceive do it 'treats the warning as a broadcast message' do expect_any_instance_of(GitlabNet).to receive(:post_receive).and_return(response) - expect(gitlab_post_receive).to receive(:print_broadcast_message).with("WARNINGS:\nMy warning message") + expect(gitlab_post_receive).to receive(:print_formatted_alert_message).with("WARNINGS:\nMy warning message") expect(gitlab_post_receive.exec).to eq(true) end end |