Sha256: 97e2544389532b64f9213d024e2ecaf690daeee010d9d42d16f4b13d777e5637

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

require 'spec_helper'

describe Auth0::Client do
  shared_examples_for 'v2 API client' do
    it { should be_a Auth0::Api::V2 }
    it { should be_a Auth0::Api::V2::Clients }
    it { should be_a Auth0::Api::V2::Users }
    it { should be_a Auth0::Api::V2::Stats }
    it { should be_a Auth0::Api::V2::Jobs }
    it { should be_a Auth0::Api::V2::Blacklists }
  end

  shared_examples_for 'authentication API client' do
    it { should be_a Auth0::Api::AuthenticationEndpoints }
  end

  let(:domain) { 'samples.auth0.com' }
  let(:client_id) { 'client_id' }
  let(:client_secret) { 'client_secret' }
  let(:access_token) { 'token' }

  describe 'V2 client' do
    before :each do
      expect_any_instance_of(Auth0::Api::AuthenticationEndpoints).not_to receive(:obtain_access_token)
    end

    context 'with namespace' do
      let(:subject) { Auth0::Client.new(access_token: 'access_token', namespace: 'samples.auth0.com') }
      it_should_behave_like 'v2 API client'
      it_should_behave_like 'authentication API client'
    end

    context 'with domain' do
      let(:subject) { Auth0::Client.new(access_token: 'access_token', domain: 'samples.auth0.com') }
      it_should_behave_like 'v2 API client'
      it_should_behave_like 'authentication API client'
    end

    context 'with version' do
      let(:subject) { Auth0::Client.new(api_version: 2, access_token: 'access_token', domain: 'samples.auth0.com') }
      it_should_behave_like 'v2 API client'
      it_should_behave_like 'authentication API client'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
auth0-4.5.0 spec/lib/auth0/client_spec.rb
auth0-4.4.0 spec/lib/auth0/client_spec.rb