1515 organization : nil
1616 } }
1717
18- let ( :params ) { {
18+ let ( :params ) { {
1919 domain : domain ,
2020 client_id : client_id ,
2121 client_secret : client_secret ,
4343 ) ) )
4444
4545 expect ( JSON . parse ( arg [ :payload ] , { symbolize_names : true } ) ) . to eq ( payload )
46-
47- StubResponse . new ( {
48- "access_token" => "test" ,
49- "expires_in" => 86400 } ,
50- true ,
46+
47+ StubResponse . new ( {
48+ "access_token" => "test" ,
49+ "expires_in" => 86400 } ,
50+ true ,
5151 200 )
5252 end
5353
54- instance . send ( : get_token)
54+ instance . get_token
5555
5656 expect ( instance . instance_variable_get ( '@token' ) ) . to eq ( 'test' )
5757 expect ( instance . instance_variable_get ( '@token_expires_at' ) ) . to eq ( time_now . to_i + 86400 )
6666 url : 'https://samples.auth0.com/oauth/token' ,
6767 ) )
6868
69- instance . send ( : get_token)
69+ instance . get_token
7070
7171 expect ( instance . instance_variable_get ( '@token' ) ) . to eq ( 'test-token' )
7272 expect ( instance . instance_variable_get ( '@token_expires_at' ) ) . to eq ( time_now . to_i + 86400 )
8484 ) ) )
8585
8686 expect ( JSON . parse ( arg [ :payload ] , { symbolize_names : true } ) ) . to eq ( payload )
87-
88- StubResponse . new ( {
89- "access_token" => "renewed_token" ,
90- "expires_in" => 86400 } ,
91- true ,
87+
88+ StubResponse . new ( {
89+ "access_token" => "renewed_token" ,
90+ "expires_in" => 86400 } ,
91+ true ,
9292 200 )
9393 end
9494
95- instance . send ( : get_token)
95+ instance . get_token
9696
9797 expect ( instance . instance_variable_get ( '@token' ) ) . to eq ( 'renewed_token' )
9898 expect ( instance . instance_variable_get ( '@token_expires_at' ) ) . to eq ( time_now . to_i + 86400 )
110110 ) ) )
111111
112112 expect ( JSON . parse ( arg [ :payload ] , { symbolize_names : true } ) ) . to eq ( payload )
113-
114- StubResponse . new ( {
115- "access_token" => "renewed_token" ,
116- "expires_in" => 86400 } ,
117- true ,
113+
114+ StubResponse . new ( {
115+ "access_token" => "renewed_token" ,
116+ "expires_in" => 86400 } ,
117+ true ,
118118 200 )
119119 end
120120
121- instance . send ( : get_token)
121+ instance . get_token
122122
123123 expect ( instance . instance_variable_get ( '@token' ) ) . to eq ( 'renewed_token' )
124124 expect ( instance . instance_variable_get ( '@token_expires_at' ) ) . to eq ( time_now . to_i + 86400 )
130130
131131 expect ( RestClient ::Request ) . not_to receive ( :execute )
132132
133- instance . send ( : get_token)
133+ expect ( instance . get_token ) . to eq ( 'test-token' )
134134 end
135135 end
136- end
136+ end
0 commit comments