From 85ad601e33340864ab1c2f27cda22ccba00bee31 Mon Sep 17 00:00:00 2001 From: Andy Brody Date: Tue, 8 Jul 2014 02:58:54 -0700 Subject: [PATCH] Fix incorrect reliance on proc equality. --- spec/unit/resource_spec.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 33f8617..9070739 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -86,17 +86,21 @@ describe RestClient::Resource do end it "the block should be overrideable" do - block1 = Proc.new{|r| r} - block2 = Proc.new{|r| r} + block1 = Proc.new {|r| r} + block2 = Proc.new {|r| } parent = RestClient::Resource.new('http://example.com', &block1) # parent['posts', &block2].block.should eq block2 # ruby 1.9 syntax parent.send(:[], 'posts', &block2).block.should eq block2 + parent.send(:[], 'posts', &block2).block.should_not eq block1 end it "the block should be overrideable in ruby 1.9 syntax" do - block = Proc.new{|r| r} - parent = RestClient::Resource.new('http://example.com', &block) - parent['posts', &->(r){r}].block.should_not eq block + block1 = Proc.new {|r| r} + block2 = ->(r) {} + + parent = RestClient::Resource.new('http://example.com', &block1) + parent['posts', &block2].block.should eq block2 + parent['posts', &block2].block.should_not eq block1 end it "prints its url with to_s" do