1- require ' helper'
1+ require " helper"
22
33describe OmniAuth ::Strategies ::OAuth2 do
44 def app
55 lambda do |_env |
6- [ 200 , { } , [ ' Hello.' ] ]
6+ [ 200 , { } , [ " Hello." ] ]
77 end
88 end
99 let ( :fresh_strategy ) { Class . new ( OmniAuth ::Strategies ::OAuth2 ) }
@@ -16,83 +16,83 @@ def app
1616 OmniAuth . config . test_mode = false
1717 end
1818
19- describe ' #client' do
19+ describe " #client" do
2020 subject { fresh_strategy }
2121
22- it ' is initialized with symbolized client_options' do
23- instance = subject . new ( app , :client_options => { ' authorize_url' => ' https://example.com' } )
24- expect ( instance . client . options [ :authorize_url ] ) . to eq ( ' https://example.com' )
22+ it " is initialized with symbolized client_options" do
23+ instance = subject . new ( app , :client_options => { " authorize_url" => " https://example.com" } )
24+ expect ( instance . client . options [ :authorize_url ] ) . to eq ( " https://example.com" )
2525 end
2626
27- it ' sets ssl options as connection options' do
28- instance = subject . new ( app , :client_options => { ' ssl' => { ' ca_path' => ' foo' } } )
29- expect ( instance . client . options [ :connection_opts ] [ :ssl ] ) . to eq ( :ca_path => ' foo' )
27+ it " sets ssl options as connection options" do
28+ instance = subject . new ( app , :client_options => { " ssl" => { " ca_path" => " foo" } } )
29+ expect ( instance . client . options [ :connection_opts ] [ :ssl ] ) . to eq ( :ca_path => " foo" )
3030 end
3131 end
3232
33- describe ' #authorize_params' do
33+ describe " #authorize_params" do
3434 subject { fresh_strategy }
3535
36- it ' includes any authorize params passed in the :authorize_params option' do
37- instance = subject . new ( ' abc' , ' def' , :authorize_params => { :foo => ' bar' , :baz => ' zip' } )
38- expect ( instance . authorize_params [ ' foo' ] ) . to eq ( ' bar' )
39- expect ( instance . authorize_params [ ' baz' ] ) . to eq ( ' zip' )
36+ it " includes any authorize params passed in the :authorize_params option" do
37+ instance = subject . new ( " abc" , " def" , :authorize_params => { :foo => " bar" , :baz => " zip" } )
38+ expect ( instance . authorize_params [ " foo" ] ) . to eq ( " bar" )
39+ expect ( instance . authorize_params [ " baz" ] ) . to eq ( " zip" )
4040 end
4141
42- it ' includes top-level options that are marked as :authorize_options' do
43- instance = subject . new ( ' abc' , ' def' , :authorize_options => [ :scope , :foo , :state ] , :scope => ' bar' , :foo => ' baz' )
44- expect ( instance . authorize_params [ ' scope' ] ) . to eq ( ' bar' )
45- expect ( instance . authorize_params [ ' foo' ] ) . to eq ( ' baz' )
42+ it " includes top-level options that are marked as :authorize_options" do
43+ instance = subject . new ( " abc" , " def" , :authorize_options => [ :scope , :foo , :state ] , :scope => " bar" , :foo => " baz" )
44+ expect ( instance . authorize_params [ " scope" ] ) . to eq ( " bar" )
45+ expect ( instance . authorize_params [ " foo" ] ) . to eq ( " baz" )
4646 end
4747
48- it ' includes random state in the authorize params' do
49- instance = subject . new ( ' abc' , ' def' )
50- expect ( instance . authorize_params . keys ) . to eq ( [ ' state' ] )
51- expect ( instance . session [ ' omniauth.state' ] ) . not_to be_empty
48+ it " includes random state in the authorize params" do
49+ instance = subject . new ( " abc" , " def" )
50+ expect ( instance . authorize_params . keys ) . to eq ( [ " state" ] )
51+ expect ( instance . session [ " omniauth.state" ] ) . not_to be_empty
5252 end
5353 end
5454
55- describe ' #token_params' do
55+ describe " #token_params" do
5656 subject { fresh_strategy }
5757
58- it ' includes any authorize params passed in the :authorize_params option' do
59- instance = subject . new ( ' abc' , ' def' , :token_params => { :foo => ' bar' , :baz => ' zip' } )
60- expect ( instance . token_params ) . to eq ( ' foo' => ' bar' , ' baz' => ' zip' )
58+ it " includes any authorize params passed in the :authorize_params option" do
59+ instance = subject . new ( " abc" , " def" , :token_params => { :foo => " bar" , :baz => " zip" } )
60+ expect ( instance . token_params ) . to eq ( " foo" => " bar" , " baz" => " zip" )
6161 end
6262
63- it ' includes top-level options that are marked as :authorize_options' do
64- instance = subject . new ( ' abc' , ' def' , :token_options => [ :scope , :foo ] , :scope => ' bar' , :foo => ' baz' )
65- expect ( instance . token_params ) . to eq ( ' scope' => ' bar' , ' foo' => ' baz' )
63+ it " includes top-level options that are marked as :authorize_options" do
64+ instance = subject . new ( " abc" , " def" , :token_options => [ :scope , :foo ] , :scope => " bar" , :foo => " baz" )
65+ expect ( instance . token_params ) . to eq ( " scope" => " bar" , " foo" => " baz" )
6666 end
6767 end
6868
69- describe ' #callback_phase' do
69+ describe " #callback_phase" do
7070 subject { fresh_strategy }
71- it ' calls fail with the client error received' do
72- instance = subject . new ( ' abc' , ' def' )
71+ it " calls fail with the client error received" do
72+ instance = subject . new ( " abc" , " def" )
7373 allow ( instance ) . to receive ( :request ) do
74- double ( ' Request' , :params => { ' error_reason' => ' user_denied' , ' error' => ' access_denied' } )
74+ double ( " Request" , :params => { " error_reason" => " user_denied" , " error" => " access_denied" } )
7575 end
7676
77- expect ( instance ) . to receive ( :fail! ) . with ( ' user_denied' , anything )
77+ expect ( instance ) . to receive ( :fail! ) . with ( " user_denied" , anything )
7878 instance . callback_phase
7979 end
8080 end
8181end
8282
8383describe OmniAuth ::Strategies ::OAuth2 ::CallbackError do
8484 let ( :error ) { Class . new ( OmniAuth ::Strategies ::OAuth2 ::CallbackError ) }
85- describe ' #message' do
85+ describe " #message" do
8686 subject { error }
87- it ' includes all of the attributes' do
88- instance = subject . new ( ' error' , ' description' , ' uri' )
87+ it " includes all of the attributes" do
88+ instance = subject . new ( " error" , " description" , " uri" )
8989 expect ( instance . message ) . to match ( /error/ )
9090 expect ( instance . message ) . to match ( /description/ )
9191 expect ( instance . message ) . to match ( /uri/ )
9292 end
93- it ' includes all of the attributes' do
93+ it " includes all of the attributes" do
9494 instance = subject . new ( nil , :symbol )
95- expect ( instance . message ) . to eq ( ' symbol' )
95+ expect ( instance . message ) . to eq ( " symbol" )
9696 end
9797 end
9898end
0 commit comments