Refactors custom page view and include specs

This commit is contained in:
decabeza
2018-02-14 17:52:10 +01:00
parent f7c7f0201a
commit 990dc072be
2 changed files with 48 additions and 5 deletions

View File

@@ -72,6 +72,45 @@ feature "Custom Pages" do
expect(page).not_to have_content("Print this info")
end
scenario "Show all fields and text with links" do
custom_page = create(:site_customization_page, :published,
slug: "slug-with-all-fields-filled",
title: "Custom page",
subtitle: "This is my new custom page",
content: "Text for new custom page with a link to https://consul.dev",
print_content_flag: true,
locale: "en"
)
visit custom_page.url
expect(page).to have_title("Custom page")
expect(page).to have_selector("h1", text: "Custom page")
expect(page).to have_selector("h2", text: "This is my new custom page")
expect(page).to have_content("Text for new custom page with a link to https://consul.dev")
expect(page).to have_link("https://consul.dev")
expect(page).to have_content("Print this info")
end
scenario "Don't show subtitle if its blank" do
custom_page = create(:site_customization_page, :published,
slug: "slug-without-subtitle",
title: "Custom page",
subtitle: "",
content: "Text for new custom page",
print_content_flag: false,
locale: "en"
)
visit custom_page.url
expect(page).to have_title("Custom page")
expect(page).to have_selector("h1", text: "Custom page")
expect(page).to have_content("Text for new custom page")
expect(page).not_to have_selector("h2")
expect(page).not_to have_content("Print this info")
end
scenario "Listed in more information page" do
custom_page = create(:site_customization_page, :published,
slug: "another-slug", title: "Another custom page",