[rspec-users] .with(:anything) issue

Matt Wynne matt at mattwynne.net
Thu Nov 13 08:44:26 EST 2008


On 13 Nov 2008, at 13:42, David Chelimsky wrote:
> On Thu, Nov 13, 2008 at 7:38 AM, Emmanuel Pirsch  
> <emmanuel at pirsch.org> wrote:
>> Hi,
>>
>> I'm using a expectation like this :
>> repository.should_receive(:add_gem).with("test.txt", :anything)
>
> Try the anything() method. Support for symbols as argument matchers
> was deprecated and removed.
>
> Are you still seeing docs somewhere that talk about using symbols?

I know I always go on about this (and never do anything about it) but  
the symbols are still all over the docs:
http://rspec.info/documentation/mocks/message_expectations.html

> Argument Constraints
>
> Constraints can be placed on individual arguments which are looser  
> than value
> equivalence (as above).
> :anything
>
> accepts any value for this argument, e.g.:
>
> my_mock.should_receive(:msg).with(1, :anything, "A")

cheers,
Matt


More information about the rspec-users mailing list