Skip to content

Commit 0a95122

Browse files
committed
Add has_service? to page_nature
Add a small helper method to easier figure out, if a page has a service.
1 parent e9b8752 commit 0a95122

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

app/models/alchemy/page/page_natures.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ def cache_page?
173173

174174
definition.cache != false && definition.searchresults != true
175175
end
176+
177+
def has_service?
178+
definition.service.present?
179+
end
176180
end
177181
end
178182
end

spec/models/alchemy/page_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,6 +1915,20 @@ module Alchemy
19151915
end
19161916
end
19171917

1918+
describe "#has_service?" do
1919+
let(:page) { build(:alchemy_page) }
1920+
1921+
subject { page.has_service? }
1922+
1923+
it { expect(subject).to be_falsey }
1924+
1925+
context "when page has a service" do
1926+
let(:page) { build(:alchemy_page, page_layout: "with_service") }
1927+
1928+
it { expect(subject).to be_truthy }
1929+
end
1930+
end
1931+
19181932
describe "#expiration_time" do
19191933
subject { page.expiration_time }
19201934

0 commit comments

Comments
 (0)