Skip to content

Commit

Permalink
Add spec for PagesHelper#page_title
Browse files Browse the repository at this point in the history
This pushes the spec coverage for the pages_helper to 100%, freeing us
of codecov issues.
  • Loading branch information
mamhoff committed May 7, 2024
1 parent cbef269 commit d7860dc
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions spec/helpers/alchemy/pages_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,45 @@ module Alchemy
end
end

describe "#page_title" do
let(:response) { double("response", status: 200) }

before do
allow(helper).to receive(:response) { response }
@page = public_page
end

subject { helper.page_title }

context "when current page has a title set" do
before { public_page.title = "My Public Page" }

it { is_expected.to eq "My Public Page" }
end

context "when current page has no title set" do
before do
language_root.title = "Title from language root"
end

context "when current page is the language root page" do
before { @page = language_root }

it { is_expected.to eq "Title from language root" }
end
end

context "when response status is not 200" do
let(:response) { double("response", status: 404) }

before { public_page.title = "My Public Page" }

it "should return the status code" do
is_expected.to eq "404"
end
end
end

describe "meta data" do
before { @page = public_page }

Expand Down

0 comments on commit d7860dc

Please sign in to comment.