File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments