Skip to content

Commit 97fe30c

Browse files
committed
Add page url_path spec
The spec for the url_path was missing.
1 parent 7bd2d02 commit 97fe30c

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

spec/models/alchemy/page_spec.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,34 @@ module Alchemy
330330
end
331331
end
332332

333+
describe ".url_path" do
334+
let(:page) { create(:alchemy_page, name: "Foo") }
335+
336+
subject { page.url_path }
337+
338+
it { is_expected.to eq("/foo") }
339+
340+
context "with optional parameters" do
341+
subject { page.url_path({page: 2}) }
342+
343+
it { is_expected.to eq("/foo?page=2") }
344+
end
345+
346+
context "with a custom url_path_class" do
347+
let(:url_path_class) { Struct.new(:page, :params) { def call = "/bar" } }
348+
349+
before do
350+
described_class.url_path_class = url_path_class
351+
end
352+
353+
after do
354+
described_class.url_path_class = Alchemy::Page::UrlPath
355+
end
356+
357+
it { is_expected.to eq("/bar") }
358+
end
359+
end
360+
333361
describe ".all_from_clipboard_for_select" do
334362
context "with clipboard holding pages having non unique page layout" do
335363
it "should return the pages" do

0 commit comments

Comments
 (0)