Skip to content
Merged
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
1 change: 1 addition & 0 deletions app/controllers/invitations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def cancel_meeting

def set_invitation
@invitation = Invitation.find_by(token: params[:token])
raise ActionController::RoutingError, 'Invitation not found' unless @invitation
end

def load_invitation
Expand Down
30 changes: 30 additions & 0 deletions spec/controllers/invitations_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
RSpec.describe InvitationsController do
let(:event) { Fabricate(:event) }

describe 'GET #show' do
context 'with invalid token' do
it 'returns http not found' do
get :show, params: { event_id: event.id, token: 'invalid_token' }
expect(response).to have_http_status(:not_found)
end
end
end

describe 'POST #attend' do
context 'with invalid token' do
it 'returns http not found' do
post :attend, params: { event_id: event.id, token: 'invalid_token' }
expect(response).to have_http_status(:not_found)
end
end
end

describe 'POST #reject' do
context 'with invalid token' do
it 'returns http not found' do
post :reject, params: { event_id: event.id, token: 'invalid_token' }
expect(response).to have_http_status(:not_found)
end
end
end
end