From b6e3dbc6d0b54f3bcdabc85baf6f6f1cd51ec5e1 Mon Sep 17 00:00:00 2001 From: Clyde Date: Fri, 13 Sep 2024 14:39:57 -0700 Subject: [PATCH] adds ticket master and fixes attendee destroy controller action --- app/controllers/api/v1/attendees_controller.rb | 3 ++- spec/requests/api/v1/attendee_request_spec.rb | 9 +++++---- spec/services/ticket_master_service_spec.rb | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/controllers/api/v1/attendees_controller.rb b/app/controllers/api/v1/attendees_controller.rb index 867f766..3687f66 100644 --- a/app/controllers/api/v1/attendees_controller.rb +++ b/app/controllers/api/v1/attendees_controller.rb @@ -10,7 +10,8 @@ def create end def destroy - attendee = Attendee.find_by(user_id: params[:id]) + attendee = Attendee.find_by(id: params[:id]) + if attendee attendee.destroy render json: { message: 'Attendee removed successfully' }, status: :ok diff --git a/spec/requests/api/v1/attendee_request_spec.rb b/spec/requests/api/v1/attendee_request_spec.rb index 2bba7ea..343da45 100644 --- a/spec/requests/api/v1/attendee_request_spec.rb +++ b/spec/requests/api/v1/attendee_request_spec.rb @@ -69,13 +69,14 @@ # end it "destroys an existing attendee" do - atttendee_id = @attendee.id + attendee_id = @attendee.id + + delete "/api/v1/attendees/#{attendee_id}" - delete "/api/v1/attendees/#{atttendee_id}" expect(response).to be_successful - expect(response.status).to eq(204) + expect(response.status).to eq(200) - expect(Attendee.find_by(id: atttendee_id)).to be_nil + expect(Attendee.find_by(id: attendee_id)).to be_nil end end \ No newline at end of file diff --git a/spec/services/ticket_master_service_spec.rb b/spec/services/ticket_master_service_spec.rb index eb06f6d..6d04e94 100644 --- a/spec/services/ticket_master_service_spec.rb +++ b/spec/services/ticket_master_service_spec.rb @@ -16,7 +16,7 @@ events = TicketMasterService.get_events(artist) expect(events).to be_a(Hash) - require 'pry'; binding.pry + end end end \ No newline at end of file