Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.

Commit ca40f72

Browse files
committed
v0.8.2 release.
1 parent 4263e9b commit ca40f72

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

test/lib/omniauth/strategies/openid_connect_test.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,20 @@ def test_request_phase_via_http
174174
def test_option_acr_values
175175
strategy.options.client_options[:host] = 'foobar.com'
176176

177-
refute_match /acr_values=/, strategy.authorize_uri, 'URI must not contain acr_values' #/
177+
refute_includes strategy.authorize_params.keys, :acr_values,
178+
'URI must not contain acr_values' #/
178179

179180
strategy.options.acr_values = 'urn:some:acr:values:value'
180-
assert_match /acr_values=/, strategy.authorize_uri, 'URI must contain acr_values'
181+
assert_includes strategy.authorize_params.keys, :acr_values,
182+
'URI must contain acr_values'
181183
end
182184

185+
183186
def test_option_custom_attributes
184187
strategy.options.client_options[:host] = 'foobar.com'
185188
strategy.options.extra_authorize_params = {resource: 'xyz'}
186-
assert_match /resource=xyz/, strategy.authorize_uri, 'URI must contain custom params'
189+
assert_match 'xyz', strategy.authorize_params[:resource],
190+
'URI must contain custom params'
187191
end
188192

189193

@@ -428,11 +432,10 @@ def test_callback_phase_with_invalid_state
428432

429433
strategy.call!('rack.session' => { 'omniauth.state' => state,
430434
'omniauth.nonce' => nonce })
435+
strategy.expects(:fail!)
431436
result = strategy.callback_phase
432437
assert_kind_of Array, result
433438
assert_equal 302, result.first, 'Expecting redirect to /callback/failure'
434-
435-
strategy.expects(:fail!)
436439
end
437440

438441
def test_callback_phase_without_code
@@ -687,7 +690,8 @@ def test_state
687690
def test_dynamic_state
688691
# Stub request parameters
689692
request.stubs(:path_info).returns('')
690-
strategy.call!('rack.session' => { }, QUERY_STRING: { state: 'abc', client_id: '123' } )
693+
strategy.call!('rack.session' => { },
694+
Rack::QUERY_STRING => { state: 'abc', client_id: '123' } )
691695

692696
assert_kind_of Array, result
693697
assert_equal 302, result.first, 'Expecting redirect to /auth/failure'

test/strategy_test_case.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,14 @@ def user_info
4343

4444
def request
4545
# stub Rack::Request
46-
@request ||= Rack::Request.new({}).tap do |request|
47-
request.stubs(:params).returns({})
48-
request.stubs(:cookies).returns({})
46+
@request ||= Rack::Request.new({
47+
'rack.input' => '',
48+
'rack.url_scheme' => 'http'})
49+
#request.stubs(:params).returns({})
50+
#request.stubs(:cookies).returns({})
4951
#request.stubs(:env).returns({}) set by ctor
50-
request.stubs(:scheme).returns('http')
52+
#request.stubs(:scheme).returns('http')
5153
#request.stubs(:ssl?).returns(false)
52-
end
5354
end
5455

5556
def strategy

0 commit comments

Comments
 (0)