Sha256: eb1738c476537f8a334f6f2449b28c305ca8d94bad515b71c55ed06ff5caad3c

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe NexaasID::Resources::Widget do
  let(:client) do
    NexaasID::Client::Identity.new(
      user_credentials(configuration),
      configuration
    )
  end
  let(:configuration) { default_configuration }
  let(:resource) { client.widget }

  describe '#navbar_url' do
    subject { resource.navbar_url }
    let(:regexp) { %r(#{Regexp.quote(configuration.url)}/api/v1/widgets/navbar\?access_token=(.+?)$) }

    it 'returns the navbar url for this user' do
      VCR.use_cassette('identity/widget/navbar_url/success') do
        expect(subject).to match(regexp)
        expect(Faraday.get(subject).status).to eq(200)
      end
    end
  end

  describe '#widget_url' do
    subject { resource.widget_url }
    let(:regexp) { %r(#{Regexp.quote(configuration.url)}/api/v1/widgets/user.js\?access_token=(.+?)&callback=initWidget$) }

    it 'returns the navbar url for this user' do
      VCR.use_cassette('identity/widget/widget_url/success') do
        expect(subject).to match(regexp)
        expect(Faraday.get(subject).status).to eq(200)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nexaas_id-client-0.7.4 spec/nexaas_id/resources/widget_spec.rb
nexaas_id-client-0.7.3 spec/nexaas_id/resources/widget_spec.rb
nexaas_id-client-0.7.2 spec/nexaas_id/resources/widget_spec.rb