1
0
Fork 0
mirror of https://github.com/simi/omniauth-facebook.git synced 2022-11-09 12:32:45 -05:00

Merge pull request #94 from weilu/use-hash-rocket-syntax

Use hash rocket syntax for ruby-1.8.7
This commit is contained in:
Mark Dodwell 2012-11-23 20:22:12 -08:00
commit 9ae9f282b9
2 changed files with 4 additions and 4 deletions

View file

@ -219,14 +219,14 @@ module OmniAuth
def image_url uid, options def image_url uid, options
uri_class = options[:secure_image_url] ? URI::HTTPS : URI::HTTP uri_class = options[:secure_image_url] ? URI::HTTPS : URI::HTTP
url = uri_class.build({host: 'graph.facebook.com', path: "/#{uid}/picture"}) url = uri_class.build({:host => 'graph.facebook.com', :path => "/#{uid}/picture"})
query = if options[:image_size].is_a?(String) query = if options[:image_size].is_a?(String)
{ type: options[:image_size] } { :type => options[:image_size] }
elsif options[:image_size].is_a?(Hash) elsif options[:image_size].is_a?(Hash)
options[:image_size] options[:image_size]
end end
url.query = URI.encode_www_form(query) if query url.query = Rack::Utils.build_query(query) if query
url.to_s url.to_s
end end

View file

@ -118,7 +118,7 @@ class InfoTest < StrategyTestCase
end end
test 'returns the image with width and height specified in the `image_size` option' do test 'returns the image with width and height specified in the `image_size` option' do
@options = { :image_size => { width: 123, height: 987 } } @options = { :image_size => { :width => 123, :height => 987 } }
raw_info = { 'name' => 'Fred Smith', 'id' => '321' } raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
strategy.stubs(:raw_info).returns(raw_info) strategy.stubs(:raw_info).returns(raw_info)
assert_equal 'http://graph.facebook.com/321/picture?width=123&height=987', strategy.info['image'] assert_equal 'http://graph.facebook.com/321/picture?width=123&height=987', strategy.info['image']