spec/omniauth/strategies/azure_oauth2_spec.rb in omniauth-azure-oauth2-0.0.6 vs spec/omniauth/strategies/azure_oauth2_spec.rb in omniauth-azure-oauth2-0.0.8
- old
+ new
@@ -29,30 +29,35 @@
OmniAuth::Strategies::AzureOauth2.new(app, {client_id: 'id', client_secret: 'secret', tenant_id: 'tenant'}.merge(options))
end
describe '#client' do
it 'has correct authorize url' do
- expect(subject.client.options[:authorize_url]).to eql('https://login.windows.net/tenant/oauth2/authorize')
+ allow(subject).to receive(:request) { request }
+ expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.com/tenant/oauth2/authorize')
end
it 'has correct authorize params' do
+ allow(subject).to receive(:request) { request }
subject.client
expect(subject.authorize_params[:domain_hint]).to be_nil
end
it 'has correct token url' do
- expect(subject.client.options[:token_url]).to eql('https://login.windows.net/tenant/oauth2/token')
+ allow(subject).to receive(:request) { request }
+ expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.com/tenant/oauth2/token')
end
it 'has correct token params' do
+ allow(subject).to receive(:request) { request }
subject.client
expect(subject.token_params[:resource]).to eql('00000002-0000-0000-c000-000000000000')
end
describe "overrides" do
it 'should override domain_hint' do
@options = {domain_hint: 'hint'}
+ allow(subject).to receive(:request) { request }
subject.client
expect(subject.authorize_params[:domain_hint]).to eql('hint')
end
end
end
@@ -63,17 +68,21 @@
let(:options) { @options || {} }
subject do
OmniAuth::Strategies::AzureOauth2.new(app, {client_id: 'id', client_secret: 'secret'}.merge(options))
end
+ before do
+ allow(subject).to receive(:request) { request }
+ 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')
+ expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.com/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')
+ expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.com/common/oauth2/token')
end
end
end
describe 'dynamic configuration' do
@@ -99,22 +108,26 @@
subject do
OmniAuth::Strategies::AzureOauth2.new(app, provider_klass)
end
+ before do
+ allow(subject).to receive(:request) { request }
+ end
+
describe '#client' do
it 'has correct authorize url' do
- expect(subject.client.options[:authorize_url]).to eql('https://login.windows.net/tenant/oauth2/authorize')
+ expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.com/tenant/oauth2/authorize')
end
it 'has correct authorize params' do
subject.client
expect(subject.authorize_params[:domain_hint]).to be_nil
end
it 'has correct token url' do
- expect(subject.client.options[:token_url]).to eql('https://login.windows.net/tenant/oauth2/token')
+ expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.com/tenant/oauth2/token')
end
it 'has correct token params' do
subject.client
expect(subject.token_params[:resource]).to eql('00000002-0000-0000-c000-000000000000')
@@ -150,17 +163,21 @@
subject do
OmniAuth::Strategies::AzureOauth2.new(app, provider_klass)
end
+ before do
+ allow(subject).to receive(:request) { request }
+ 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')
+ expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.com/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')
+ expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.com/common/oauth2/token')
end
end
end
describe "raw_info" do
@@ -174,11 +191,12 @@
let(:access_token) do
double(:token => token)
end
- before :each do
+ before do
allow(subject).to receive(:access_token) { access_token }
+ allow(subject).to receive(:request) { request }
end
it "does not clash if JWT strategy is used" do
expect do
subject.info