8 | 8 |
|
9 | 9 |
class ClientTest < StrategyTestCase
|
10 | 10 |
test 'has correct Facebook site' do
|
11 | |
assert_equal 'https://graph.facebook.com', strategy.client.site
|
|
11 |
assert_equal 'https://graph.facebook.com/v2.6', strategy.client.site
|
12 | 12 |
end
|
13 | 13 |
|
14 | 14 |
test 'has correct authorize url' do
|
15 | |
assert_equal 'https://www.facebook.com/dialog/oauth', strategy.client.options[:authorize_url]
|
|
15 |
assert_equal 'https://www.facebook.com/v2.6/dialog/oauth', strategy.client.options[:authorize_url]
|
16 | 16 |
end
|
17 | 17 |
|
18 | 18 |
test 'has correct token url with versioning' do
|
|
72 | 72 |
end
|
73 | 73 |
end
|
74 | 74 |
|
75 | |
class TokeParamsTest < StrategyTestCase
|
76 | |
test 'has correct parse strategy' do
|
77 | |
assert_equal :query, strategy.token_params[:parse]
|
78 | |
end
|
79 | |
end
|
80 | |
|
81 | 75 |
class AccessTokenOptionsTest < StrategyTestCase
|
82 | 76 |
test 'has correct param name by default' do
|
83 | 77 |
assert_equal 'access_token', strategy.access_token_options[:param_name]
|
|
104 | 98 |
@options = { :secure_image_url => true }
|
105 | 99 |
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
106 | 100 |
strategy.stubs(:raw_info).returns(raw_info)
|
107 | |
assert_equal 'https://graph.facebook.com/321/picture', strategy.info['image']
|
|
101 |
assert_equal 'https://graph.facebook.com/v2.6/321/picture', strategy.info['image']
|
108 | 102 |
end
|
109 | 103 |
|
110 | 104 |
test 'returns the image_url based of the client site' do
|
|
118 | 112 |
@options = { :image_size => 'normal' }
|
119 | 113 |
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
120 | 114 |
strategy.stubs(:raw_info).returns(raw_info)
|
121 | |
assert_equal 'http://graph.facebook.com/321/picture?type=normal', strategy.info['image']
|
|
115 |
assert_equal 'http://graph.facebook.com/v2.6/321/picture?type=normal', strategy.info['image']
|
122 | 116 |
end
|
123 | 117 |
|
124 | 118 |
test 'returns the image with size specified as a symbol in the `image_size` option' do
|
125 | 119 |
@options = { :image_size => :normal }
|
126 | 120 |
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
127 | 121 |
strategy.stubs(:raw_info).returns(raw_info)
|
128 | |
assert_equal 'http://graph.facebook.com/321/picture?type=normal', strategy.info['image']
|
|
122 |
assert_equal 'http://graph.facebook.com/v2.6/321/picture?type=normal', strategy.info['image']
|
129 | 123 |
end
|
130 | 124 |
|
131 | 125 |
test 'returns the image with width and height specified in the `image_size` option' do
|
|
134 | 128 |
strategy.stubs(:raw_info).returns(raw_info)
|
135 | 129 |
assert_match 'width=123', strategy.info['image']
|
136 | 130 |
assert_match 'height=987', strategy.info['image']
|
137 | |
assert_match 'http://graph.facebook.com/321/picture?', strategy.info['image']
|
|
131 |
assert_match 'http://graph.facebook.com/v2.6/321/picture?', strategy.info['image']
|
138 | 132 |
end
|
139 | 133 |
end
|
140 | 134 |
|
|
181 | 175 |
|
182 | 176 |
test 'returns the facebook avatar url' do
|
183 | 177 |
@raw_info['id'] = '321'
|
184 | |
assert_equal 'http://graph.facebook.com/321/picture', strategy.info['image']
|
|
178 |
assert_equal 'http://graph.facebook.com/v2.6/321/picture', strategy.info['image']
|
185 | 179 |
end
|
186 | 180 |
|
187 | 181 |
test 'returns the Facebook link as the Facebook url' do
|
|
263 | 257 |
@options = {:appsecret_proof => @appsecret_proof, :fields => 'name,email'}
|
264 | 258 |
end
|
265 | 259 |
|
266 | |
test 'performs a GET to https://graph.facebook.com/me' do
|
|
260 |
test 'performs a GET to https://graph.facebook.com/v2.6/me' do
|
267 | 261 |
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
268 | 262 |
strategy.stubs(:access_token).returns(@access_token)
|
269 | 263 |
params = {:params => @options}
|
|
271 | 265 |
strategy.raw_info
|
272 | 266 |
end
|
273 | 267 |
|
274 | |
test 'performs a GET to https://graph.facebook.com/me with locale' do
|
|
268 |
test 'performs a GET to https://graph.facebook.com/v2.6/me with locale' do
|
275 | 269 |
@options.merge!({ :locale => 'cs_CZ' })
|
276 | 270 |
strategy.stubs(:access_token).returns(@access_token)
|
277 | 271 |
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
|
280 | 274 |
strategy.raw_info
|
281 | 275 |
end
|
282 | 276 |
|
283 | |
test 'performs a GET to https://graph.facebook.com/me with info_fields' do
|
|
277 |
test 'performs a GET to https://graph.facebook.com/v2.6/me with info_fields' do
|
284 | 278 |
@options.merge!({:info_fields => 'about'})
|
285 | 279 |
strategy.stubs(:access_token).returns(@access_token)
|
286 | 280 |
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
|
289 | 283 |
strategy.raw_info
|
290 | 284 |
end
|
291 | 285 |
|
292 | |
test 'performs a GET to https://graph.facebook.com/me with default info_fields' do
|
|
286 |
test 'performs a GET to https://graph.facebook.com/v2.6/me with default info_fields' do
|
293 | 287 |
strategy.stubs(:access_token).returns(@access_token)
|
294 | 288 |
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
295 | 289 |
params = {:params => {:appsecret_proof => @appsecret_proof, :fields => 'name,email'}}
|