Codebase list ruby-omniauth-facebook / d541116
allow the image_size option to be set as a symbol Jonas Grau 9 years ago
2 changed file(s) with 8 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
189189 site_uri = URI.parse(client.site)
190190 url = uri_class.build({:host => site_uri.host, :path => "#{site_uri.path}/#{uid}/picture"})
191191
192 query = if options[:image_size].is_a?(String)
192 query = if options[:image_size].is_a?(String) || options[:image_size].is_a?(Symbol)
193193 { :type => options[:image_size] }
194194 elsif options[:image_size].is_a?(Hash)
195195 options[:image_size]
114114
115115 test 'returns the image with size specified in the `image_size` option' do
116116 @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 }
117124 raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
118125 strategy.stubs(:raw_info).returns(raw_info)
119126 assert_equal 'http://graph.facebook.com/321/picture?type=normal', strategy.info['image']