@@ -14,7 +14,7 @@ def app; lambda{|env| [200, {}, ["Hello."]]} end
14
14
15
15
describe '#client' do
16
16
subject { fresh_strategy }
17
-
17
+
18
18
it 'should be initialized with symbolized client_options' do
19
19
instance = subject . new ( app , :client_options => { 'authorize_url' => 'https://example.com' } )
20
20
instance . client . options [ :authorize_url ] . should == 'https://example.com'
@@ -30,20 +30,21 @@ def app; lambda{|env| [200, {}, ["Hello."]]} end
30
30
subject { fresh_strategy }
31
31
32
32
it 'should include any authorize params passed in the :authorize_params option' do
33
- instance = subject . new ( 'abc' , 'def' , :authorize_params => { :foo => 'bar' , :baz => 'zip' , :state => '123' } )
34
- instance . authorize_params . should == { 'foo' => 'bar' , 'baz' => 'zip' , 'state' => '123' }
33
+ instance = subject . new ( 'abc' , 'def' , :authorize_params => { :foo => 'bar' , :baz => 'zip' } )
34
+ instance . authorize_params [ 'foo' ] . should == 'bar'
35
+ instance . authorize_params [ 'baz' ] . should == 'zip'
35
36
end
36
37
37
38
it 'should include top-level options that are marked as :authorize_options' do
38
- instance = subject . new ( 'abc' , 'def' , :authorize_options => [ :scope , :foo ] , :scope => 'bar' , :foo => 'baz' , :authorize_params => { :state => '123' } )
39
- instance . authorize_params . should == { 'scope' => 'bar' , 'foo' => 'baz' , 'state' => '123' }
39
+ instance = subject . new ( 'abc' , 'def' , :authorize_options => [ :scope , :foo , :state ] , :scope => 'bar' , :foo => 'baz' )
40
+ instance . authorize_params [ 'scope' ] . should == 'bar'
41
+ instance . authorize_params [ 'foo' ] . should == 'baz'
40
42
end
41
43
42
44
it 'should include random state in the authorize params' do
43
45
instance = subject . new ( 'abc' , 'def' )
44
46
instance . authorize_params . keys . should == [ 'state' ]
45
47
instance . session [ 'omniauth.state' ] . should_not be_empty
46
- instance . session [ 'omniauth.state' ] . should == instance . authorize_params [ 'state' ]
47
48
end
48
49
end
49
50
0 commit comments