1
0
Fork 0
mirror of https://github.com/rest-client/rest-client.git synced 2022-11-09 13:49:40 -05:00

Fix incorrect reliance on proc equality.

This commit is contained in:
Andy Brody 2014-07-08 02:58:54 -07:00
parent 3316e639ca
commit 85ad601e33

View file

@ -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