Skip to content

Commit

Permalink
Extend and restructure LegacyPageUrl spec
Browse files Browse the repository at this point in the history
  • Loading branch information
robinboening committed Dec 12, 2020
1 parent 23f125c commit 295294c
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions spec/models/alchemy/legacy_page_url_spec.rb
Expand Up @@ -5,25 +5,27 @@
describe Alchemy::LegacyPageUrl do
let(:page) { build_stubbed(:alchemy_page) }

let(:page_url_with_parameters) do
Alchemy::LegacyPageUrl.new(urlname: "index.php?id=2", page: page)
end

let(:valid_page_url) do
Alchemy::LegacyPageUrl.new(urlname: "my/0-work+is-nice_stuff", page: page)
it "is invalid with invalid URL characters" do
expect(
described_class.new(urlname: "<foo>{bar}", page: page)
).to be_invalid
end

it "is only valid with correct urlname format" do
expect(valid_page_url).to be_valid
it "is valid with correct urlname format" do
expect(
described_class.new(urlname: "my/0-work+is-nice_stuff", page: page)
).to be_valid
end

it "is also valid with get parameters in urlname" do
expect(page_url_with_parameters).to be_valid
it "is valid with get parameters in urlname" do
expect(
described_class.new(urlname: "index.php?id=2", page: page)
).to be_valid
end

it "is valid with pound sign in urlname" do
expect(
Alchemy::LegacyPageUrl.new(urlname: "with#anchor", page: page)
described_class.new(urlname: "with#anchor", page: page)
).to be_valid
end
end

0 comments on commit 295294c

Please sign in to comment.