summaryrefslogtreecommitdiff
path: root/spec/views/layouts/_flash.html.haml_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/views/layouts/_flash.html.haml_spec.rb')
-rw-r--r--spec/views/layouts/_flash.html.haml_spec.rb25
1 files changed, 22 insertions, 3 deletions
diff --git a/spec/views/layouts/_flash.html.haml_spec.rb b/spec/views/layouts/_flash.html.haml_spec.rb
index a4bed09368f..d88977b194a 100644
--- a/spec/views/layouts/_flash.html.haml_spec.rb
+++ b/spec/views/layouts/_flash.html.haml_spec.rb
@@ -3,9 +3,20 @@
require 'spec_helper'
RSpec.describe 'layouts/_flash' do
+ let_it_be(:template) { 'layouts/_flash' }
+ let_it_be(:flash_container_no_margin_class) { 'flash-container-no-margin' }
+
+ let(:locals) { {} }
+
before do
allow(view).to receive(:flash).and_return(flash)
- render
+ render(template: template, locals: locals)
+ end
+
+ describe 'default' do
+ it 'does not render flash container no margin class' do
+ expect(rendered).not_to have_selector(".#{flash_container_no_margin_class}")
+ end
end
describe 'closable flash messages' do
@@ -17,7 +28,7 @@ RSpec.describe 'layouts/_flash' do
let(:flash) { { flash_type => 'This is a closable flash message' } }
it 'shows a close button' do
- expect(rendered).to include('js-close-icon')
+ expect(rendered).to include('js-close')
end
end
end
@@ -31,8 +42,16 @@ RSpec.describe 'layouts/_flash' do
let(:flash) { { flash_type => 'This is a non closable flash message' } }
it 'does not show a close button' do
- expect(rendered).not_to include('js-close-icon')
+ expect(rendered).not_to include('js-close')
end
end
end
+
+ describe 'with flash_class in locals' do
+ let(:locals) { { flash_container_no_margin: true } }
+
+ it 'adds class to flash-container' do
+ expect(rendered).to have_selector(".flash-container.#{flash_container_no_margin_class}")
+ end
+ end
end