[rspec-users] should_receive with block or proc?

Alexander Baronec abonec at gmail.com
Mon Aug 6 07:48:45 UTC 2012


It don't work when object received few messages. I described it there:
http://stackoverflow.com/questions/11669979/should-recieve-alongside-other-messages

2012/8/5 David Chelimsky <dchelimsky at gmail.com>

> On Sat, Aug 4, 2012 at 1:46 PM, Alexander Baronec <abonec at gmail.com>
> wrote:
> > Hello.
> > How can I test object to receive message and compare arguments of this
> > message with value evaluated at present time? It is possible?
> >
> > For example:
> >
> > should_receive(:api_send).with( -> { players.count } ) And players.count
> > will be called and evaluated only when api_send is received.
>
> Look at Fake Implementation on
> https://www.relishapp.com/rspec/rspec-mocks/v/2-11/docs/method-stubs.
> You can do the same thing w/ should_receive, e.g.
>
> foo.should_receive(:api_send) do |player_count|
>   player_count.should eq players.count
> end
>
> HTH,
> David
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



-- 
С наилучшими пожеланиями,
Александр
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120806/32c64aae/attachment-0001.html>


More information about the rspec-users mailing list