test/gravatarify_base_test.rb in gravatarify-0.6.0 vs test/gravatarify_base_test.rb in gravatarify-0.7.0

- old
+ new

@@ -53,11 +53,11 @@ assert_equal "http://0.gravatar.com/avatar/1cacf1bc403efca2e7a58bcfa9574e4d.gif", build_gravatar_url('bella@gmail.com', :filetype => :gif) assert_equal "http://0.gravatar.com/avatar/1cacf1bc403efca2e7a58bcfa9574e4d.png", build_gravatar_url('bella@gmail.com', :filetype => :png) end should "handle Procs as :default, to easily generate default urls based on supplied :size" do - default = Proc.new { |o| "http://example.com/gravatar#{o[:size] ? '-' + o[:size].to_s : ''}.jpg" } + default = Proc.new { |*args| "http://example.com/gravatar#{args.first[:size] ? '-' + args.first[:size].to_s : ''}.jpg" } assert_equal "http://0.gravatar.com/avatar/1cacf1bc403efca2e7a58bcfa9574e4d.jpg?d=http%3A%2F%2Fexample.com%2Fgravatar.jpg", build_gravatar_url('bella@gmail.com', :default => default) assert_equal "http://0.gravatar.com/avatar/1cacf1bc403efca2e7a58bcfa9574e4d.jpg?d=http%3A%2F%2Fexample.com%2Fgravatar-25.jpg&s=25", build_gravatar_url('bella@gmail.com', :size => 25, :d => default) assert_equal "http://0.gravatar.com/avatar/1cacf1bc403efca2e7a58bcfa9574e4d.jpg?d=http%3A%2F%2Fexample.com%2Fgravatar-20.jpg&s=20", @@ -102,10 +102,10 @@ assert_equal "https://secure.gravatar.com/avatar/41d86cad3dd465d6913d5a3232744441.jpg", build_gravatar_url('bella@bella.com', :secure => true) assert_equal "https://secure.gravatar.com/avatar/d2279c22a33da2cb57defd21c33c8ec5.jpg", build_gravatar_url('bella@yahoo.de', :secure => true) end should "allow Procs for :secure option, enables pretty cool stuff for stuff like request.ssl?" do - Gravatarify.options[:secure] = Proc.new { |request| request.respond_to?(:ssl?) ? request.ssl? : false } + Gravatarify.options[:secure] = Proc.new { |obj| obj.request.ssl? } mock_ssl = MockView.new mock(mock_ssl).request.stub!.ssl? { true } assert_equal "https://secure.gravatar.com/avatar/1cacf1bc403efca2e7a58bcfa9574e4d.jpg", mock_ssl.build_gravatar_url('bella@gmail.com')