Skip to content

Commit

Permalink
Fix helper specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Dutil authored and Jeff Dutil committed Dec 2, 2014
1 parent 109180f commit 620caa7
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions frontend/spec/helpers/frontend_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@ module Spree
describe FrontendHelper, type: :helper do
# Regression test for #2034
context "flash_message" do
let(:flash) { {"notice" => "ok", "foo" => "foo", "bar" => "bar"} }
let(:flash) { { "notice" => "ok", "foo" => "foo", "bar" => "bar" } }

it "should output all flash content" do
flash_messages
html = Nokogiri::HTML(helper.output_buffer)
expect(html.css(".notice").text).to eq("ok")
expect(html.css(".foo").text).to eq("foo")
expect(html.css(".bar").text).to eq("bar")
expect(html.css(".alert-notice").text).to eq("ok")
expect(html.css(".alert-foo").text).to eq("foo")
expect(html.css(".alert-bar").text).to eq("bar")
end

it "should output flash content except one key" do
flash_messages(ignore_types: :bar)
html = Nokogiri::HTML(helper.output_buffer)
expect(html.css(".notice").text).to eq("ok")
expect(html.css(".foo").text).to eq("foo")
expect(html.css(".bar").text).to be_empty
expect(html.css(".alert-notice").text).to eq("ok")
expect(html.css(".alert-foo").text).to eq("foo")
expect(html.css(".alert-bar").text).to be_empty
end

it "should output flash content except some keys" do
flash_messages(ignore_types: [:foo, :bar])
html = Nokogiri::HTML(helper.output_buffer)
expect(html.css(".notice").text).to eq("ok")
expect(html.css(".foo").text).to be_empty
expect(html.css(".bar").text).to be_empty
expect(helper.output_buffer).to eq("<div class=\"flash notice\">ok</div>")
expect(html.css(".alert-notice").text).to eq("ok")
expect(html.css(".alert-foo").text).to be_empty
expect(html.css(".alert-bar").text).to be_empty
expect(helper.output_buffer).to eq("<div class=\"alert alert-notice\">ok</div>")
end
end

Expand Down

0 comments on commit 620caa7

Please sign in to comment.