Sha256: 241a4d46f4025219c0bb5d25720c7318385a04aed0f6272161a483683d90e384
Contents?: true
Size: 1.85 KB
Versions: 1
Compression:
Stored size: 1.85 KB
Contents
RSpec.describe Symphonia::ApplicationHelper do describe "#title" do it "returns the default title" do expect(helper.title("Holub")).to match /<(h1)\s.*id=\Wpage_header\W\s.*Holub<\/\1>/ end it "with symbol" do expect(helper.title(:title)).to match /<(h1)\s.*id=\Wpage_header\W\s.*Title<\/\1>/ end it "with back" do expect(helper.title("Head", back: true)).to include "history.back()" end it "with custom back" do expect(helper.title("Head", back: "/path")).to include "/path" end it "xhr without back" do allow(helper.request).to receive(:xhr?).and_return true expect(helper.title("Head", back: true)).to match /<(h5)\s.*id=\Wpage_header\W\s.*Head<\/\1>/ end end describe "#render_flash_messages" do it "render error" do r = helper.render_flash_messages(error: "flash message") expect(r).to include "danger" end it "render notice" do r = helper.render_flash_messages(notice: "flash message") expect(r).to include "success" end it "render warning" do r = helper.render_flash_messages(warning: "flash message") expect(r).to include "warning" end it "render info" do r = helper.render_flash_messages(info: "flash message") expect(r).to include "info" end end describe "#format_html" do it "plain text" do expect(helper.format_html("sojka")).to eq "<div class=\"formatted-text\"><p>sojka</p>\n</div>" end it "plain text" do expect(helper.format_html("# sojka")).to eq "<div class=\"formatted-text\"><h1>sojka</h1>\n</div>" end end describe "#render_no_data" do it "default" do expect(helper.render_no_data).to include t(:text_no_data), "nodata" end it "custom message" do expect(helper.render_no_data("Sorry bro")).to include "Sorry bro", "nodata" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
symphonia-2.1.7 | spec/helpers/symphonia/application_helper_spec.rb |