Sha256: 3d72c5ea2961ba0b499231ee9136c4875153efb873e8d0e35237306539cf8d83

Contents?: true

Size: 1.54 KB

Versions: 2

Compression:

Stored size: 1.54 KB

Contents

# frozen_string_literal: true

require "spec_helper"

describe OmniAuth::Strategies::NitroId do
  let(:access_token) { instance_double("AccessToken", :options => {}, :[] => "user") }
  let(:custom_client) do
    OmniAuth::Strategies::NitroId.new(:test_app,
                                      issuer: "https://example-host.com/",
                                      discovery: false,
                                      client_options: {
                                        host: "example-host.com",
                                      })
  end

  subject do
    OmniAuth::Strategies::NitroId.new({})
  end

  before(:each) do
    allow(subject).to receive(:access_token).and_return(access_token)
  end

  context "options" do
    it "should have correct name" do
      expect(subject.options.name).to eq "nitro_id"
    end

    it "should have correct host" do
      expect(subject.options.client_options.host).to eq "id.powerhrg.com"
    end

    it "should have correct issuer" do
      expect(subject.options.issuer).to eq "https://id.powerhrg.com"
    end

    it "should have the correct discovery setting" do
      expect(subject.options.discovery).to eq true
    end

    describe "should be overrideable" do
      it "for host" do
        expect(custom_client.options.client_options.host).to eq "example-host.com"
      end

      it "for issuer" do
        expect(custom_client.options.issuer).to eq "https://example-host.com/"
      end

      it "for discovery" do
        expect(custom_client.options.discovery).to eq false
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omniauth-nitro-id-1.3.3 spec/omniauth/strategies/nitro_id_spec.rb
omniauth-nitro-id-1.3.2 spec/omniauth/strategies/nitro_id_spec.rb