Check title and slug in spec

This commit is contained in:
Papaya Labs
2018-09-28 09:43:00 +02:00
parent 5a4b9b0810
commit 3f9dea080b

View File

@@ -11,6 +11,7 @@ feature "Admin custom pages" do
custom_page = create(:site_customization_page) custom_page = create(:site_customization_page)
visit admin_site_customization_pages_path visit admin_site_customization_pages_path
expect(page).to have_content(custom_page.title)
expect(page).to have_content(custom_page.slug) expect(page).to have_content(custom_page.slug)
end end
@@ -22,6 +23,7 @@ feature "Admin custom pages" do
click_link "Custom pages" click_link "Custom pages"
end end
expect(page).not_to have_content "An example custom page"
expect(page).not_to have_content "example-page" expect(page).not_to have_content "example-page"
click_link "Create new page" click_link "Create new page"
@@ -33,13 +35,14 @@ feature "Admin custom pages" do
click_button "Create Custom page" click_button "Create Custom page"
expect(page).to have_content "An example custom page"
expect(page).to have_content "example-page" expect(page).to have_content "example-page"
end end
end end
context "Update" do context "Update" do
scenario "Valid custom page" do scenario "Valid custom page" do
create(:site_customization_page, title: "An example custom page") create(:site_customization_page, title: "An example custom page", slug: "custom-example-page")
visit admin_root_path visit admin_root_path
within("#side_menu") do within("#side_menu") do
@@ -49,12 +52,15 @@ feature "Admin custom pages" do
click_link "An example custom page" click_link "An example custom page"
expect(page).to have_selector("h2", text: "An example custom page") expect(page).to have_selector("h2", text: "An example custom page")
expect(page).to have_selector("input[value='custom-example-page']")
fill_in "site_customization_page_title_en", with: "Another example custom page" fill_in "site_customization_page_title_en", with: "Another example custom page"
fill_in "site_customization_page_slug", with: "another-custom-example-page"
click_button "Update Custom page" click_button "Update Custom page"
expect(page).to have_content "Page updated successfully" expect(page).to have_content "Page updated successfully"
expect(page).to have_content "Another example custom page" expect(page).to have_content "Another example custom page"
expect(page).to have_content "another-custom-example-page"
end end
end end
@@ -64,6 +70,7 @@ feature "Admin custom pages" do
click_link "Delete page" click_link "Delete page"
expect(page).not_to have_content("An example custom page") expect(page).not_to have_content "An example custom page"
expect(page).not_to have_content "example-page"
end end
end end