Skip to content

Commit

Permalink
Merge pull request #8 from concertmate/feat/delete_event
Browse files Browse the repository at this point in the history
delete an event
  • Loading branch information
clydeautin authored Sep 12, 2024
2 parents 045ee57 + 3a92ba7 commit 27df080
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/controllers/api/v1/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ def create
end
end

def destroy
event = Event.find(params[:id])
event.destroy
end

private

def event_params
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,21 @@

end
end

describe '#delete' do
it 'deletes an event' do
event_params = Event.create(
event_name: "Bluegrass Week",
venue_name: "San Antonio Fair",
date_time: "2024-12-31T20:00:00Z",
artist: "Marty Robbins",
location: "San Antonio, TX")

delete "/api/v1/events/#{event_params.id}"
# require 'pry'; binding.pry
expect(response).to be_successful
expect(response.status).to eq(204)

end
end
end

0 comments on commit 27df080

Please sign in to comment.