Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/controllers/challenge_signups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class ChallengeSignupsController < ApplicationController
before_action :check_signup_in_collection, only: [:show, :edit, :update, :destroy, :confirm_delete]

def load_challenge
raise ActiveRecord::RecordNotFound, "Couldn't find collection named '#{params[:collection_id]}'" unless @collection

@challenge = @collection.challenge
no_challenge and return unless @challenge
end
Expand Down
19 changes: 19 additions & 0 deletions spec/controllers/challenge_signups_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,25 @@
"What challenge did you want to sign up for?")
end
end

context "when collection does not exist" do
it "raises a RecordNotFound error" do
fake_login
expect do
get :new, params: { collection_id: "nonexistent_collection" }
end.to raise_error ActiveRecord::RecordNotFound
end
end
end

describe "summary" do
context "when collection does not exist" do
it "raises a RecordNotFound error" do
expect do
get :summary, params: { collection_id: "nonexistent_collection" }
end.to raise_error ActiveRecord::RecordNotFound
end
end
end

describe "show" do
Expand Down
Loading