8 | 8 |
|
9 | 9 |
class ClientTest < StrategyTestCase
|
10 | 10 |
test 'has correct Facebook site' do
|
11 | |
assert_equal 'https://graph.facebook.com/v2.6', strategy.client.site
|
|
11 |
assert_equal 'https://graph.facebook.com/v2.10', strategy.client.site
|
12 | 12 |
end
|
13 | 13 |
|
14 | 14 |
test 'has correct authorize url' do
|
15 | |
assert_equal 'https://www.facebook.com/v2.6/dialog/oauth', strategy.client.options[:authorize_url]
|
|
15 |
assert_equal 'https://www.facebook.com/v2.10/dialog/oauth', strategy.client.options[:authorize_url]
|
16 | 16 |
end
|
17 | 17 |
|
18 | 18 |
test 'has correct token url with versioning' do
|
|
98 | 98 |
@options = { secure_image_url: true }
|
99 | 99 |
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
100 | 100 |
strategy.stubs(:raw_info).returns(raw_info)
|
101 | |
assert_equal 'https://graph.facebook.com/v2.6/321/picture', strategy.info['image']
|
|
101 |
assert_equal 'https://graph.facebook.com/v2.10/321/picture', strategy.info['image']
|
102 | 102 |
end
|
103 | 103 |
|
104 | 104 |
test 'returns the image_url based of the client site' do
|
|
112 | 112 |
@options = { image_size: 'normal' }
|
113 | 113 |
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
114 | 114 |
strategy.stubs(:raw_info).returns(raw_info)
|
115 | |
assert_equal 'http://graph.facebook.com/v2.6/321/picture?type=normal', strategy.info['image']
|
|
115 |
assert_equal 'http://graph.facebook.com/v2.10/321/picture?type=normal', strategy.info['image']
|
116 | 116 |
end
|
117 | 117 |
|
118 | 118 |
test 'returns the image with size specified as a symbol in the `image_size` option' do
|
119 | 119 |
@options = { image_size: :normal }
|
120 | 120 |
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
121 | 121 |
strategy.stubs(:raw_info).returns(raw_info)
|
122 | |
assert_equal 'http://graph.facebook.com/v2.6/321/picture?type=normal', strategy.info['image']
|
|
122 |
assert_equal 'http://graph.facebook.com/v2.10/321/picture?type=normal', strategy.info['image']
|
123 | 123 |
end
|
124 | 124 |
|
125 | 125 |
test 'returns the image with width and height specified in the `image_size` option' do
|
|
128 | 128 |
strategy.stubs(:raw_info).returns(raw_info)
|
129 | 129 |
assert_match 'width=123', strategy.info['image']
|
130 | 130 |
assert_match 'height=987', strategy.info['image']
|
131 | |
assert_match 'http://graph.facebook.com/v2.6/321/picture?', strategy.info['image']
|
|
131 |
assert_match 'http://graph.facebook.com/v2.10/321/picture?', strategy.info['image']
|
132 | 132 |
end
|
133 | 133 |
end
|
134 | 134 |
|
|
175 | 175 |
|
176 | 176 |
test 'returns the facebook avatar url' do
|
177 | 177 |
@raw_info['id'] = '321'
|
178 | |
assert_equal 'http://graph.facebook.com/v2.6/321/picture', strategy.info['image']
|
|
178 |
assert_equal 'http://graph.facebook.com/v2.10/321/picture', strategy.info['image']
|
179 | 179 |
end
|
180 | 180 |
|
181 | 181 |
test 'returns the Facebook link as the Facebook url' do
|
|
257 | 257 |
@options = {appsecret_proof: @appsecret_proof, fields: 'name,email'}
|
258 | 258 |
end
|
259 | 259 |
|
260 | |
test 'performs a GET to https://graph.facebook.com/v2.6/me' do
|
|
260 |
test 'performs a GET to https://graph.facebook.com/v2.10/me' do
|
261 | 261 |
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
262 | 262 |
strategy.stubs(:access_token).returns(@access_token)
|
263 | 263 |
params = {params: @options}
|
|
265 | 265 |
strategy.raw_info
|
266 | 266 |
end
|
267 | 267 |
|
268 | |
test 'performs a GET to https://graph.facebook.com/v2.6/me with locale' do
|
|
268 |
test 'performs a GET to https://graph.facebook.com/v2.10/me with locale' do
|
269 | 269 |
@options.merge!({ locale: 'cs_CZ' })
|
270 | 270 |
strategy.stubs(:access_token).returns(@access_token)
|
271 | 271 |
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
|
274 | 274 |
strategy.raw_info
|
275 | 275 |
end
|
276 | 276 |
|
277 | |
test 'performs a GET to https://graph.facebook.com/v2.6/me with info_fields' do
|
|
277 |
test 'performs a GET to https://graph.facebook.com/v2.10/me with info_fields' do
|
278 | 278 |
@options.merge!({info_fields: 'about'})
|
279 | 279 |
strategy.stubs(:access_token).returns(@access_token)
|
280 | 280 |
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
|
283 | 283 |
strategy.raw_info
|
284 | 284 |
end
|
285 | 285 |
|
286 | |
test 'performs a GET to https://graph.facebook.com/v2.6/me with default info_fields' do
|
|
286 |
test 'performs a GET to https://graph.facebook.com/v2.10/me with default info_fields' do
|
287 | 287 |
strategy.stubs(:access_token).returns(@access_token)
|
288 | 288 |
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
289 | 289 |
params = {params: {appsecret_proof: @appsecret_proof, fields: 'name,email'}}
|