Skip to content

Commit 3a73417

Browse files
authored
Merge pull request #3354 from AlchemyCMS/fix-page-info-url_path
2 parents e4a0ab8 + d054db2 commit 3a73417

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

app/views/alchemy/admin/pages/info.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</div>
1616
<div class="value">
1717
<label><%= Alchemy::Page.human_attribute_name(:urlname) %></label>
18-
<p><%= "/#{@page.urlname}" %></p>
18+
<p><%= @page.url_path %></p>
1919
</div>
2020
<div class="value">
2121
<label><%= Alchemy.t(:page_status) %></label>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# frozen_string_literal: true
2+
3+
require "rails_helper"
4+
5+
RSpec.describe "Show page info feature", type: :system do
6+
let(:alchemy_page) { create(:alchemy_page) }
7+
8+
context "as anonymous user" do
9+
it "redirects to login page" do
10+
visit alchemy.info_admin_page_path(alchemy_page)
11+
expect(page).to have_current_path(Alchemy.login_path)
12+
end
13+
end
14+
15+
context "as author" do
16+
before do
17+
authorize_user(:as_author)
18+
expect_any_instance_of(Alchemy::Page).to receive(:url_path) { "/en/page-urlname" }
19+
end
20+
21+
it "shows page info dialog", :aggregate_failures do
22+
visit alchemy.info_admin_page_path(alchemy_page)
23+
24+
within ".resource_info" do
25+
expect(page).to have_content("Page type Standard")
26+
expect(page).to have_content("URL-Path /en/page-urlname")
27+
expect(page).to have_content("Status Page is unavailable for website visitors. Page is accessible by all visitors.")
28+
expect(page).to have_content("Was created from unknown at " + I18n.l(alchemy_page.created_at, format: :"alchemy.page_status"))
29+
expect(page).to have_content("Was updated from unknown at " + I18n.l(alchemy_page.updated_at, format: :"alchemy.page_status"))
30+
end
31+
end
32+
end
33+
end

0 commit comments

Comments
 (0)