Sha256: 1274698ff927887949181e1f5b5d16ca8f766d7646d4481c4df8cb966832add9

Contents?: true

Size: 823 Bytes

Versions: 2

Compression:

Stored size: 823 Bytes

Contents

require 'rails_helper'

RSpec.describe ActiveAdmin::ViewHelpers::FlashHelper do

  describe '.flash_messages' do
    let(:view) { action_view }

    it "should not include 'timedout' flash messages by default" do
      view.request.flash[:alert] = "Alert"
      view.request.flash[:timedout] = true
      expect(view.flash_messages).to include 'alert'
      expect(view.flash_messages).to_not include 'timedout'
    end

    it "should not return flash messages included in flash_keys_to_except" do
      expect(view.active_admin_application).to receive(:flash_keys_to_except).and_return ["hideme"]
      view.request.flash[:alert] = "Alert"
      view.request.flash[:hideme] = "Do not show"
      expect(view.flash_messages).to include 'alert'
      expect(view.flash_messages).to_not include 'hideme'
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activeadmin-1.0.0 spec/unit/view_helpers/flash_helper_spec.rb
activeadmin-1.0.0.pre5 spec/unit/view_helpers/flash_helper_spec.rb