Sha256: 139572efe063ce9433805f593b17e2b328d3afd57cf92324286ca01e20891855

Contents?: true

Size: 982 Bytes

Versions: 3

Compression:

Stored size: 982 Bytes

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
          }
        }
      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

3 entries across 3 versions & 1 rubygems

Version Path
osso-0.0.3.8 spec/graphql/query/oauth_clients_account_spec.rb
osso-0.0.3.7 spec/graphql/query/oauth_clients_account_spec.rb
osso-0.0.3.6 spec/graphql/query/oauth_clients_account_spec.rb