@@ -31,26 +31,31 @@ module JWT; end
31
31
32
32
describe '#client' do
33
33
it 'has correct authorize url' do
34
+ allow ( subject ) . to receive ( :request ) { request }
34
35
expect ( subject . client . options [ :authorize_url ] ) . to eql ( 'https://login.microsoftonline.com/tenant/oauth2/authorize' )
35
36
end
36
37
37
38
it 'has correct authorize params' do
39
+ allow ( subject ) . to receive ( :request ) { request }
38
40
subject . client
39
41
expect ( subject . authorize_params [ :domain_hint ] ) . to be_nil
40
42
end
41
43
42
44
it 'has correct token url' do
45
+ allow ( subject ) . to receive ( :request ) { request }
43
46
expect ( subject . client . options [ :token_url ] ) . to eql ( 'https://login.microsoftonline.com/tenant/oauth2/token' )
44
47
end
45
48
46
49
it 'has correct token params' do
50
+ allow ( subject ) . to receive ( :request ) { request }
47
51
subject . client
48
52
expect ( subject . token_params [ :resource ] ) . to eql ( '00000002-0000-0000-c000-000000000000' )
49
53
end
50
54
51
55
describe "overrides" do
52
56
it 'should override domain_hint' do
53
57
@options = { domain_hint : 'hint' }
58
+ allow ( subject ) . to receive ( :request ) { request }
54
59
subject . client
55
60
expect ( subject . authorize_params [ :domain_hint ] ) . to eql ( 'hint' )
56
61
end
@@ -65,6 +70,10 @@ module JWT; end
65
70
OmniAuth ::Strategies ::AzureOauth2 . new ( app , { client_id : 'id' , client_secret : 'secret' } . merge ( options ) )
66
71
end
67
72
73
+ before do
74
+ allow ( subject ) . to receive ( :request ) { request }
75
+ end
76
+
68
77
describe '#client' do
69
78
it 'has correct authorize url' do
70
79
expect ( subject . client . options [ :authorize_url ] ) . to eql ( 'https://login.microsoftonline.com/common/oauth2/authorize' )
@@ -101,6 +110,10 @@ def tenant_id
101
110
OmniAuth ::Strategies ::AzureOauth2 . new ( app , provider_klass )
102
111
end
103
112
113
+ before do
114
+ allow ( subject ) . to receive ( :request ) { request }
115
+ end
116
+
104
117
describe '#client' do
105
118
it 'has correct authorize url' do
106
119
expect ( subject . client . options [ :authorize_url ] ) . to eql ( 'https://login.microsoftonline.com/tenant/oauth2/authorize' )
@@ -152,6 +165,10 @@ def client_secret
152
165
OmniAuth ::Strategies ::AzureOauth2 . new ( app , provider_klass )
153
166
end
154
167
168
+ before do
169
+ allow ( subject ) . to receive ( :request ) { request }
170
+ end
171
+
155
172
describe '#client' do
156
173
it 'has correct authorize url' do
157
174
expect ( subject . client . options [ :authorize_url ] ) . to eql ( 'https://login.microsoftonline.com/common/oauth2/authorize' )
@@ -176,8 +193,9 @@ def client_secret
176
193
double ( :token => token )
177
194
end
178
195
179
- before :each do
196
+ before do
180
197
allow ( subject ) . to receive ( :access_token ) { access_token }
198
+ allow ( subject ) . to receive ( :request ) { request }
181
199
end
182
200
183
201
it "does not clash if JWT strategy is used" do
0 commit comments