@@ -9,11 +9,11 @@ class StrategyTest < StrategyTestCase
9
9
10
10
class ClientTest < StrategyTestCase
11
11
test 'has correct Facebook site' do
12
- assert_equal ' https://graph.facebook.com/v4.0' , strategy . client . site
12
+ assert_equal " https://graph.facebook.com/#{ @facebook_api_version } " , strategy . client . site
13
13
end
14
14
15
15
test 'has correct authorize url' do
16
- assert_equal ' https://www.facebook.com/v4.0 /dialog/oauth' , strategy . client . options [ :authorize_url ]
16
+ assert_equal " https://www.facebook.com/#{ @facebook_api_version } /dialog/oauth" , strategy . client . options [ :authorize_url ]
17
17
end
18
18
19
19
test 'has correct token url with versioning' do
@@ -106,22 +106,22 @@ def setup
106
106
raw_info = { 'name' => 'Fred Smith' , 'id' => '321' }
107
107
strategy . stubs ( :raw_info ) . returns ( raw_info )
108
108
strategy . stubs ( :access_token ) . returns ( @access_token )
109
- assert_equal ' https://graph.facebook.com/v4.0 /321/picture?access_token=test_access_token' , strategy . info [ 'image' ]
109
+ assert_equal " https://graph.facebook.com/#{ @facebook_api_version } /321/picture?access_token=test_access_token" , strategy . info [ 'image' ]
110
110
end
111
111
112
112
test 'returns the non-ssl facebook avatar url when `secure_image_url` option is set to false' do
113
113
@options = { secure_image_url : false }
114
114
raw_info = { 'name' => 'Fred Smith' , 'id' => '321' }
115
115
strategy . stubs ( :raw_info ) . returns ( raw_info )
116
116
strategy . stubs ( :access_token ) . returns ( @access_token )
117
- assert_equal ' http://graph.facebook.com/v4.0 /321/picture?access_token=test_access_token' , strategy . info [ 'image' ]
117
+ assert_equal " http://graph.facebook.com/#{ @facebook_api_version } /321/picture?access_token=test_access_token" , strategy . info [ 'image' ]
118
118
end
119
119
120
120
test 'returns the secure facebook avatar url when `secure_image_url` option is omitted' do
121
121
raw_info = { 'name' => 'Fred Smith' , 'id' => '321' }
122
122
strategy . stubs ( :raw_info ) . returns ( raw_info )
123
123
strategy . stubs ( :access_token ) . returns ( @access_token )
124
- assert_equal ' https://graph.facebook.com/v4.0 /321/picture?access_token=test_access_token' , strategy . info [ 'image' ]
124
+ assert_equal " https://graph.facebook.com/#{ @facebook_api_version } /321/picture?access_token=test_access_token" , strategy . info [ 'image' ]
125
125
end
126
126
127
127
test 'returns the image_url based of the client site' do
@@ -137,15 +137,15 @@ def setup
137
137
raw_info = { 'name' => 'Fred Smith' , 'id' => '321' }
138
138
strategy . stubs ( :raw_info ) . returns ( raw_info )
139
139
strategy . stubs ( :access_token ) . returns ( @access_token )
140
- assert_equal ' https://graph.facebook.com/v4.0 /321/picture?access_token=test_access_token&type=normal' , strategy . info [ 'image' ]
140
+ assert_equal " https://graph.facebook.com/#{ @facebook_api_version } /321/picture?access_token=test_access_token&type=normal" , strategy . info [ 'image' ]
141
141
end
142
142
143
143
test 'returns the image with size specified as a symbol in the `image_size` option' do
144
144
@options = { image_size : :normal }
145
145
raw_info = { 'name' => 'Fred Smith' , 'id' => '321' }
146
146
strategy . stubs ( :raw_info ) . returns ( raw_info )
147
147
strategy . stubs ( :access_token ) . returns ( @access_token )
148
- assert_equal ' https://graph.facebook.com/v4.0 /321/picture?access_token=test_access_token&type=normal' , strategy . info [ 'image' ]
148
+ assert_equal " https://graph.facebook.com/#{ @facebook_api_version } /321/picture?access_token=test_access_token&type=normal" , strategy . info [ 'image' ]
149
149
end
150
150
151
151
test 'returns the image with width and height specified in the `image_size` option' do
@@ -155,7 +155,7 @@ def setup
155
155
strategy . stubs ( :access_token ) . returns ( @access_token )
156
156
assert_match 'width=123' , strategy . info [ 'image' ]
157
157
assert_match 'height=987' , strategy . info [ 'image' ]
158
- assert_match ' https://graph.facebook.com/v4.0 /321/picture?access_token=test_access_token' , strategy . info [ 'image' ]
158
+ assert_match " https://graph.facebook.com/#{ @facebook_api_version } /321/picture?access_token=test_access_token" , strategy . info [ 'image' ]
159
159
end
160
160
end
161
161
@@ -206,7 +206,7 @@ def setup
206
206
207
207
test 'returns the facebook avatar url' do
208
208
@raw_info [ 'id' ] = '321'
209
- assert_equal ' https://graph.facebook.com/v4.0 /321/picture?access_token=test_access_token' , strategy . info [ 'image' ]
209
+ assert_equal " https://graph.facebook.com/#{ @facebook_api_version } /321/picture?access_token=test_access_token" , strategy . info [ 'image' ]
210
210
end
211
211
212
212
test 'returns the Facebook link as the Facebook url' do
@@ -292,15 +292,15 @@ def setup
292
292
@options = { appsecret_proof : @appsecret_proof , fields : 'name,email' }
293
293
end
294
294
295
- test ' performs a GET to https://graph.facebook.com/v4.0 /me' do
295
+ test " performs a GET to https://graph.facebook.com/#{ @facebook_api_version } /me" do
296
296
strategy . stubs ( :appsecret_proof ) . returns ( @appsecret_proof )
297
297
strategy . stubs ( :access_token ) . returns ( @access_token )
298
298
params = { params : @options }
299
299
@access_token . expects ( :get ) . with ( 'me' , params ) . returns ( stub_everything ( 'OAuth2::Response' ) )
300
300
strategy . raw_info
301
301
end
302
302
303
- test ' performs a GET to https://graph.facebook.com/v4.0 /me with locale' do
303
+ test " performs a GET to https://graph.facebook.com/#{ @facebook_api_version } /me with locale" do
304
304
@options . merge! ( { locale : 'cs_CZ' } )
305
305
strategy . stubs ( :access_token ) . returns ( @access_token )
306
306
strategy . stubs ( :appsecret_proof ) . returns ( @appsecret_proof )
@@ -309,7 +309,7 @@ def setup
309
309
strategy . raw_info
310
310
end
311
311
312
- test ' performs a GET to https://graph.facebook.com/v4.0 /me with info_fields' do
312
+ test " performs a GET to https://graph.facebook.com/#{ @facebook_api_version } /me with info_fields" do
313
313
@options . merge! ( { info_fields : 'about' } )
314
314
strategy . stubs ( :access_token ) . returns ( @access_token )
315
315
strategy . stubs ( :appsecret_proof ) . returns ( @appsecret_proof )
@@ -318,7 +318,7 @@ def setup
318
318
strategy . raw_info
319
319
end
320
320
321
- test ' performs a GET to https://graph.facebook.com/v4.0 /me with default info_fields' do
321
+ test " performs a GET to https://graph.facebook.com/#{ @facebook_api_version } /me with default info_fields" do
322
322
strategy . stubs ( :access_token ) . returns ( @access_token )
323
323
strategy . stubs ( :appsecret_proof ) . returns ( @appsecret_proof )
324
324
params = { params : { appsecret_proof : @appsecret_proof , fields : 'name,email' } }
0 commit comments