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.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/views/layouts/_flash.html.haml_spec.rb b/spec/views/layouts/_flash.html.haml_spec.rb
new file mode 100644
index 00000000000..82c06feb4fb
--- /dev/null
+++ b/spec/views/layouts/_flash.html.haml_spec.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'layouts/_flash' do
+ before do
+ allow(view).to receive(:flash).and_return(flash)
+ render
+ end
+
+ describe 'closable flash messages' do
+ %w(alert notice success).each do |flash_type|
+ let(:flash) { { flash_type => 'This is a closable flash message' } }
+
+ it 'shows a close button' do
+ expect(rendered).to include('js-close-icon')
+ end
+ end
+ end
+
+ describe 'non closable flash messages' do
+ %w(error message toast warning).each do |flash_type|
+ let(:flash) { { flash_type => 'This is a non closable flash message' } }
+
+ it 'shows a close button' do
+ expect(rendered).not_to include('js-close-icon')
+ end
+ end
+ end
+end