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:
parent
3316e639ca
commit
85ad601e33
1 changed files with 9 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue