Sha256: a6332662f02438a92bb8500e25dedd1c8fb7668077dce9281787b439a22fd23a
Contents?: true
Size: 1.6 KB
Versions: 10
Compression:
Stored size: 1.6 KB
Contents
require 'rails_helper' module BootstrapLeather RSpec.describe AlertsHelper, folder: :helpers do describe '#flash_class' do describe 'with :notice' do subject { helper.flash_class(:notice) } it { should eq 'info' } end describe 'with :error' do subject { helper.flash_class(:error) } it { should eq 'danger' } end describe 'with :alert' do subject { helper.flash_class(:alert) } it { should eq 'warning' } end end describe '#alert' do subject { helper.alert 'danger', 'This is the title', 'This is the text' } it do should have_tag('div', with: { class: 'alert-danger' }) end it do should have_tag('h4', with: { class: 'alert-heading' }, text: /This is the title/) end it do should have_tag('p', text: /This is the text/) end it do should have_tag('button', with: { class: 'close' }) end end describe '#alert_flash_messages' do before do [:notice, :error, :alert].each do |level| @request.flash[level] = "This is the #{level}" end end subject { helper.alert_flash_messages } it do should have_tag 'div', with: { class: 'alert-danger' }, text: /This is the error/ end it do should have_tag 'div', with: { class: 'alert-info' }, text: /This is the notice/ end it do should have_tag 'div', with: { class: 'alert-warning' }, text: /This is the alert/ end end end end
Version data entries
10 entries across 10 versions & 1 rubygems