aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2023-12-20 16:46:40 +0000
committerMatthew Lemon <y@yulqen.org>2023-12-20 16:46:40 +0000
commit17c866a3f93e24c5d022a3b9697a5c6293795f74 (patch)
tree1253b6982ccc91fa0e231274a3c4f5f3bac68732
parentd2b567689cd113d806d8b3832658e81e07f0c01f (diff)
Fixed the first request spec for events
-rw-r--r--spec/requests/events_spec.rb9
1 files 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