session_id_spec.rb 634 B

1234567891011121314151617181920212223242526272829
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Gql::Queries::SessionId, type: :graphql do
  4. context 'when checking the SessionID' do
  5. let(:agent) { create(:agent) }
  6. let(:query) do
  7. <<~QUERY
  8. query sessionId {
  9. sessionId
  10. }
  11. QUERY
  12. end
  13. before do
  14. gql.execute(query)
  15. end
  16. context 'with authenticated session', authenticated_as: :agent do
  17. it 'has data' do
  18. expect(gql.result.data).to be_present
  19. end
  20. end
  21. it_behaves_like 'graphql responds with error if unauthenticated'
  22. end
  23. end