From 52f203a43ec519161796579b274c794f86a273c0 Mon Sep 17 00:00:00 2001 From: Lee Sheppard Date: Sat, 2 Nov 2024 22:51:06 +1100 Subject: [PATCH] Update pages_controller_spec.rb --- spec/controllers/pages_controller_spec.rb | 36 +++++++---------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb index d9a30f5..8997b78 100644 --- a/spec/controllers/pages_controller_spec.rb +++ b/spec/controllers/pages_controller_spec.rb @@ -6,38 +6,24 @@ describe "on GET to /committee-members" do before { get :show, params: { id: "committee-members" } } - it "responds with success and render template" do + it "responds with success" do expect(response).to be_successful - expect(response).to render_template("committee-members") end - end - describe "on GET to /committee-members" do - before { get :show, params: { id: "committee-members" } } - - it "responds with success and render template" do - expect(response).to be_successful + it "renders the correct template" do expect(response).to render_template("committee-members") end end - it "raises a routing error for an invalid page" do - expect { get :show, params: { id: "invalid" } } - .to raise_error(ActionController::RoutingError) - end - - it "raises a routing error for a page in another directory" do - expect { get :show, params: { id: "other/wrong" } } - .to raise_error(ActionController::RoutingError) - end - - it "raises a routing error for an invalid page" do - expect { get :show, params: { id: "invalid" } } - .to raise_error(ActionController::RoutingError) - end + context "when accessing invalid pages" do + it "raises a routing error for an invalid page" do + expect { get :show, params: { id: "invalid" } } + .to raise_error(ActionController::RoutingError) + end - it "raises a routing error for a page in another directory" do - expect { get :show, params: { id: "other/wrong" } } - .to raise_error(ActionController::RoutingError) + it "raises a routing error for a page in another directory" do + expect { get :show, params: { id: "other/wrong" } } + .to raise_error(ActionController::RoutingError) + end end end