debian-mirror-gitlab/spec/views/layouts/_flash.html.haml_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
826 B
Ruby
Raw Normal View History

2020-10-24 23:57:45 +05: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
2022-08-13 15:12:31 +05:30
where(:flash_type) do
%w[alert notice success]
end
with_them do
2020-10-24 23:57:45 +05:30
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
2022-08-13 15:12:31 +05:30
where(:flash_type) do
%w[error message toast warning]
end
with_them do
2020-10-24 23:57:45 +05:30
let(:flash) { { flash_type => 'This is a non closable flash message' } }
2022-08-13 15:12:31 +05:30
it 'does not show a close button' do
2020-10-24 23:57:45 +05:30
expect(rendered).not_to include('js-close-icon')
end
end
end
end