diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-08-17 12:15:20 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-08-17 12:15:20 +0200 |
commit | fa0624fc6409d84373f3e06275e936c9e5171b79 (patch) | |
tree | e884a367f605548365c6e3745f1a7a4457afe487 /spec/lib/gitlab/downtime_check | |
parent | 88a0c984fc0bdbe0951b02c4e1d4b749dce88a24 (diff) | |
download | gitlab-ce-fa0624fc6409d84373f3e06275e936c9e5171b79.tar.gz |
Better formatting for downtime check messagesfix-downtime-check-formatting
This removes excessive whitespace from the messages (e.g. leading
whitespace) and ensures the message is more clearly visible.
Diffstat (limited to 'spec/lib/gitlab/downtime_check')
-rw-r--r-- | spec/lib/gitlab/downtime_check/message_spec.rb | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/spec/lib/gitlab/downtime_check/message_spec.rb b/spec/lib/gitlab/downtime_check/message_spec.rb index d467d2cbd18..a5a398abf78 100644 --- a/spec/lib/gitlab/downtime_check/message_spec.rb +++ b/spec/lib/gitlab/downtime_check/message_spec.rb @@ -5,7 +5,7 @@ describe Gitlab::DowntimeCheck::Message do it 'returns an ANSI formatted String for an offline migration' do message = described_class.new('foo.rb', true, 'hello') - expect(message.to_s).to eq("[\e[31moffline\e[0m]: foo.rb: hello") + expect(message.to_s).to eq("[\e[31moffline\e[0m]: foo.rb:\n\nhello\n\n") end it 'returns an ANSI formatted String for an online migration' do @@ -14,4 +14,26 @@ describe Gitlab::DowntimeCheck::Message do expect(message.to_s).to eq("[\e[32monline\e[0m]: foo.rb") end end + + describe '#reason?' do + it 'returns false when no reason is specified' do + message = described_class.new('foo.rb') + + expect(message.reason?).to eq(false) + end + + it 'returns true when a reason is specified' do + message = described_class.new('foo.rb', true, 'hello') + + expect(message.reason?).to eq(true) + end + end + + describe '#reason' do + it 'strips excessive whitespace from the returned String' do + message = described_class.new('foo.rb', true, " hello\n world\n\n foo") + + expect(message.reason).to eq("hello\nworld\n\nfoo") + end + end end |