diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-10 03:07:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-10 03:07:56 +0300 |
commit | 775816e676aae53509d7b6f364945f2720636f72 (patch) | |
tree | 0baa821597f08edce720b236b0c07a6d13893f85 /spec/helpers | |
parent | e98d69bc8b8b926a727d36e37d2ee30c9fa28907 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/broadcast_messages_helper_spec.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/spec/helpers/broadcast_messages_helper_spec.rb b/spec/helpers/broadcast_messages_helper_spec.rb index d0f0e6f1dd5..a0682c0e278 100644 --- a/spec/helpers/broadcast_messages_helper_spec.rb +++ b/spec/helpers/broadcast_messages_helper_spec.rb @@ -4,24 +4,22 @@ require 'spec_helper' describe BroadcastMessagesHelper do describe 'broadcast_message' do + let(:current_broadcast_message) { BroadcastMessage.new(message: 'Current Message') } + it 'returns nil when no current message' do expect(helper.broadcast_message(nil)).to be_nil end it 'includes the current message' do - current = BroadcastMessage.new(message: 'Current Message') - allow(helper).to receive(:broadcast_message_style).and_return(nil) - expect(helper.broadcast_message(current)).to include 'Current Message' + expect(helper.broadcast_message(current_broadcast_message)).to include 'Current Message' end it 'includes custom style' do - current = BroadcastMessage.new(message: 'Current Message') - allow(helper).to receive(:broadcast_message_style).and_return('foo') - expect(helper.broadcast_message(current)).to include 'style="foo"' + expect(helper.broadcast_message(current_broadcast_message)).to include 'style="foo"' end end @@ -32,12 +30,18 @@ describe BroadcastMessagesHelper do expect(helper.broadcast_message_style(broadcast_message)).to eq '' end - it 'allows custom style' do - broadcast_message = double(color: '#f2dede', font: '#b94a48') + it 'allows custom style for banner messages' do + broadcast_message = BroadcastMessage.new(color: '#f2dede', font: '#b94a48', broadcast_type: "banner") expect(helper.broadcast_message_style(broadcast_message)) .to match('background-color: #f2dede; color: #b94a48') end + + it 'does not add style for notification messages' do + broadcast_message = BroadcastMessage.new(color: '#f2dede', broadcast_type: "notification") + + expect(helper.broadcast_message_style(broadcast_message)).to eq '' + end end describe 'broadcast_message_status' do |