Sha256: 604ab3a4a4a01a7695d0b6ac07db293f73ee1f3ef00625001b3caa001ea03756

Contents?: true

Size: 1 KB

Versions: 7

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Osso::GraphQL::Schema do
  describe 'OAuthClients' do
    let(:query) do
      <<~GRAPHQL
        query OAuthClients {
          oauthClients {
            name
            id
            clientSecret
            clientId
          }
        }
      GRAPHQL
    end

    before do
      create_list(:oauth_client, 2)
    end

    subject do
      described_class.execute(
        query,
        variables: nil,
        context: { scope: current_scope },
      )
    end

    describe 'for an admin user' do
      let(:current_scope) { :admin }

      it 'returns Oauth Clients' do
        expect(subject['errors']).to be_nil
        expect(subject.dig('data', 'oauthClients').count).to eq(2)
      end
    end

    describe 'for an email scoped user' do
      let(:current_scope) { 'foo.com' }

      it 'returns Oauth Clients' do
        expect(subject['errors']).to be_nil
        expect(subject.dig('data', 'oauthClients')).to be_nil
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
osso-0.0.3.16 spec/graphql/query/oauth_clients_spec.rb
osso-0.0.3.15 spec/graphql/query/oauth_clients_spec.rb
osso-0.0.3.14 spec/graphql/query/oauth_clients_spec.rb
osso-0.0.3.13 spec/graphql/query/oauth_clients_spec.rb
osso-0.0.3.12 spec/graphql/query/oauth_clients_spec.rb
osso-0.0.3.11 spec/graphql/query/oauth_clients_spec.rb
osso-0.0.3.9 spec/graphql/query/oauth_clients_spec.rb