From 81295abd8cb7e2f9e193840490d873d873337343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 26 Mar 2021 19:06:24 +0100 Subject: [PATCH] Move custom page 404 test to controller specs So it's similar to the other custom page 404 tests. Note we're explicitely marking the page as a draft so it's more obvious what's going on in the test. --- spec/controllers/pages_controller_spec.rb | 8 ++++++++ .../site_customization/custom_pages_spec.rb | 15 --------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb index c8447055e..e2a7dd425 100644 --- a/spec/controllers/pages_controller_spec.rb +++ b/spec/controllers/pages_controller_spec.rb @@ -45,5 +45,13 @@ describe PagesController do get :show, params: { id: "nonExistentJavaScript.js" } expect(response).to be_not_found end + + it "returns a 404 message for draft pages" do + create(:site_customization_page, slug: "other-slug", status: "draft") + + get :show, params: { id: "other-slug" } + + expect(response).to be_not_found + end end end diff --git a/spec/system/site_customization/custom_pages_spec.rb b/spec/system/site_customization/custom_pages_spec.rb index 68a1745cf..a85ff2db6 100644 --- a/spec/system/site_customization/custom_pages_spec.rb +++ b/spec/system/site_customization/custom_pages_spec.rb @@ -2,21 +2,6 @@ require "rails_helper" describe "Custom Pages" do context "New custom page" do - context "Draft" do - scenario "See page" do - custom_page = create(:site_customization_page, - slug: "other-slug", - title_en: "Custom page", - content_en: "Text for new custom page", - print_content_flag: false - ) - - visit custom_page.url - - expect(page.status_code).to eq(404) - end - end - context "Published" do scenario "See page" do custom_page = create(:site_customization_page, :published,