about_spec.rb 816 B

12345678910111213141516171819202122232425262728293031323334353637
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Gql::Queries::Product::About, type: :graphql do
  4. context 'when fetching product about' do
  5. let(:query) do
  6. <<~QUERY
  7. query productAbout {
  8. productAbout
  9. }
  10. QUERY
  11. end
  12. context 'when authorized', authenticated_as: :admin do
  13. let(:admin) { create(:admin) }
  14. before do
  15. gql.execute(query)
  16. end
  17. it 'returns data' do
  18. expect(gql.result.data).to eq(Version.get)
  19. end
  20. end
  21. context 'when not authorized', authenticated_as: :agent do
  22. let(:agent) { create(:agent) }
  23. before do
  24. gql.execute(query)
  25. end
  26. it_behaves_like 'graphql responds with error if unauthenticated'
  27. end
  28. end
  29. end