Sha256: 137ac88261de40eec79961b8ed3c17014f27c37eb550c99a127a46f7e3338ebe

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe SemanticFlashHelper do
  describe 'semantic_flash' do
    it 'should return warning flash message' do
      @request.flash[:warning] = 'Update Warning!'
      expect(semantic_flash).to eq '<div class="ui warning message"><i class="close icon"></i>Update Warning!</div>'
    end

    it 'should return alert-success message when using notice message' do
      @request.flash[:notice] = 'Update Success!'
      expect(semantic_flash).to eq '<div class="ui success message"><i class="close icon"></i>Update Success!</div>'
    end

    it 'should return error message when using notice alert' do
      @request.flash[:alert] = 'Update Failed!'
      expect(semantic_flash).to eq '<div class="ui error message"><i class="close icon"></i>Update Failed!</div>'
    end

    it 'should return alert-error message when using notice error' do
      @request.flash[:error] = 'Update Failed!'
      expect(semantic_flash).to eq '<div class="ui error message"><i class="close icon"></i>Update Failed!</div>'
    end

    it 'should return no message when using an undefined message' do
      @request.flash[:undefined] = 'Update Undefined!'
      expect(semantic_flash).to eq ''
    end

    it 'should return no message when the message is blank' do
      @request.flash[:notice] = ''
      expect(semantic_flash).to eq ''
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fomantic-ui-sass-2.9.3.2 spec/helpers/semantic_flash_helper_spec.rb
fomantic-ui-sass-2.9.3.1 spec/helpers/semantic_flash_helper_spec.rb