fails_if_unauthenticated.rb 460 B

12345678910111213
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. RSpec.shared_examples 'graphql responds with error if unauthenticated' do
  3. context 'without authenticated session', authenticated_as: false do
  4. it 'fails with error message' do
  5. expect(gql.result.error_message).to eq('Authentication required')
  6. end
  7. it 'fails with error type' do
  8. expect(gql.result.error_type).to eq(Exceptions::NotAuthorized)
  9. end
  10. end
  11. end