allow the image_size option to be set as a symbol
Jonas Grau
9 years ago
189 | 189 |
site_uri = URI.parse(client.site)
|
190 | 190 |
url = uri_class.build({:host => site_uri.host, :path => "#{site_uri.path}/#{uid}/picture"})
|
191 | 191 |
|
192 | |
query = if options[:image_size].is_a?(String)
|
|
192 |
query = if options[:image_size].is_a?(String) || options[:image_size].is_a?(Symbol)
|
193 | 193 |
{ :type => options[:image_size] }
|
194 | 194 |
elsif options[:image_size].is_a?(Hash)
|
195 | 195 |
options[:image_size]
|
114 | 114 |
|
115 | 115 |
test 'returns the image with size specified in the `image_size` option' do
|
116 | 116 |
@options = { :image_size => 'normal' }
|
|
117 |
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
|
118 |
strategy.stubs(:raw_info).returns(raw_info)
|
|
119 |
assert_equal 'http://graph.facebook.com/321/picture?type=normal', strategy.info['image']
|
|
120 |
end
|
|
121 |
|
|
122 |
test 'returns the image with size specified as a symbol in the `image_size` option' do
|
|
123 |
@options = { :image_size => :normal }
|
117 | 124 |
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
118 | 125 |
strategy.stubs(:raw_info).returns(raw_info)
|
119 | 126 |
assert_equal 'http://graph.facebook.com/321/picture?type=normal', strategy.info['image']
|