Re: [rspec-users] Argument Constraints where the Argument is a Hash

2008-08-18 Thread David Chelimsky
On Aug 18, 2008, at 11:10 AM, Matt Wynne <[EMAIL PROTECTED]> wrote: Hi folks, I have an object whose constructor I want to stub, specifying that it should be passed a hash containing an expected set of key / value pairs. Note that the actual hash might contain more key / value pairs,

Re: [rspec-users] Argument Constraints where the Argument is a Hash

2008-08-18 Thread Matt Wynne
Okay, I realised the with() is calling the == method on whatever you pass in, so I did this: module EquateAnyHashContainingAllMyElements def ==(other) self.keys.all? do |key| other.has_key?(key) end end end ex

[rspec-users] Argument Constraints where the Argument is a Hash

2008-08-18 Thread Matt Wynne
Hi folks, I have an object whose constructor I want to stub, specifying that it should be passed a hash containing an expected set of key / value pairs. Note that the actual hash might contain more key / value pairs, but I don't care, as long as my expected ones are there I thought I migh