Sha256: b5199c155861e869431f80e4726296821ef1b3614173c8656e0dde74e53003b6

Contents?: true

Size: 763 Bytes

Versions: 9

Compression:

Stored size: 763 Bytes

Contents

require 'rails_helper'

RSpec.describe Exposition::Admin::FlashesHelper, type: :helper do
  it "converts the the flash into a hash" do
    flash = double("flash")
    allow(flash).to receive(:to_hash).and_return({})
    allow(helper).to receive(:flash).and_return(flash)

    helper.user_facing_flashes

    expect(flash).to have_received(:to_hash)
  end

  it "removes unneeded keys" do
    flash = { "a" => "1",
              "alert" => "2",
              "error" => "3",
              "notice" => "4",
              "success" => "5"
            }

    allow(helper).to receive(:flash).and_return(flash)

    processed_flash = helper.user_facing_flashes

    expect(processed_flash).to include("alert")
    expect(processed_flash).to_not include("a")
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
exposition-0.0.5.7.pre.alpha spec/helpers/admin/flashes_helper_spec.rb
exposition-0.0.5.6.pre.alpha spec/helpers/admin/flashes_helper_spec.rb
exposition-0.0.5.5.pre.alpha spec/helpers/admin/flashes_helper_spec.rb
exposition-0.0.5.4.pre.alpha spec/helpers/admin/flashes_helper_spec.rb
exposition-0.0.5.2.pre.alpha spec/helpers/admin/flashes_helper_spec.rb
exposition-0.0.5.1.pre.alpha spec/helpers/admin/flashes_helper_spec.rb
exposition-0.0.5.pre.alpha spec/helpers/admin/flashes_helper_spec.rb
exposition-0.0.4.pre.alpha spec/helpers/admin/flashes_helper_spec.rb
exposition-0.0.3.pre.alpha spec/helpers/admin/flashes_helper_spec.rb