spec/omniauth/strategies/azure_oauth2_spec.rb in omniauth-azure-oauth2-0.0.2 vs spec/omniauth/strategies/azure_oauth2_spec.rb in omniauth-azure-oauth2-0.0.3

- old
+ new

@@ -51,11 +51,27 @@ end end end + describe 'static common configuration' do + let(:options) { @options || {} } + subject do + OmniAuth::Strategies::AzureOauth2.new(app, {client_id: 'id', client_secret: 'secret'}.merge(options)) + end + describe '#client' do + it 'has correct authorize url' do + expect(subject.client.options[:authorize_url]).to eql('https://login.windows.net/common/oauth2/authorize') + end + + it 'has correct token url' do + expect(subject.client.options[:token_url]).to eql('https://login.windows.net/common/oauth2/token') + end + end + end + describe 'dynamic configuration' do let(:provider_klass) { Class.new { def initialize(strategy) end @@ -106,7 +122,38 @@ # expect(subject.authorize_params[:domain_hint]).to eql('hint') # end # end end + end + + describe 'dynamic common configuration' do + let(:provider_klass) { + Class.new { + def initialize(strategy) + end + + def client_id + 'id' + end + + def client_secret + 'secret' + end + } + } + + subject do + OmniAuth::Strategies::AzureOauth2.new(app, provider_klass) + end + + describe '#client' do + it 'has correct authorize url' do + expect(subject.client.options[:authorize_url]).to eql('https://login.windows.net/common/oauth2/authorize') + end + + it 'has correct token url' do + expect(subject.client.options[:token_url]).to eql('https://login.windows.net/common/oauth2/token') + end + end end end \ No newline at end of file