Welcome to mirror list, hosted at ThFree Co, Russian Federation.

_flash.html.haml_spec.rb « layouts « views « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 82c06feb4fb579a5806c8beb08d9d1943d55abbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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