From 17c866a3f93e24c5d022a3b9697a5c6293795f74 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Wed, 20 Dec 2023 16:46:40 +0000 Subject: Fixed the first request spec for events --- spec/requests/events_spec.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/spec/requests/events_spec.rb b/spec/requests/events_spec.rb index d641507..f168576 100644 --- a/spec/requests/events_spec.rb +++ b/spec/requests/events_spec.rb @@ -19,8 +19,7 @@ RSpec.describe "/events", type: :request do # adjust the attributes here as well. let(:valid_attributes) { # skip("Add a hash of attributes valid for your model") - # TODO: How to do this?? - { date: Date.new(2023, 1, 10), name: "Stunner" } + { date: Date.new(2023, 1, 10), name: "Stunner", organisation_id: "2" } } let(:invalid_attributes) { @@ -59,16 +58,16 @@ RSpec.describe "/events", type: :request do end describe "POST /create" do - context "with valid parameters" do + context "with valid parameters and a default Organisation" do it "creates a new Event" do expect { post events_url, params: { event: valid_attributes } }.to change(Event, :count).by(1) end - it "redirects to the created event" do + it "redirects to the index of events" do post events_url, params: { event: valid_attributes } - expect(response).to redirect_to(event_url(Event.last)) + expect(response).to redirect_to(events_url) end end -- cgit v1.2.3