Should_receive - how to allow multiple calls

code:

info( ‘attempting to sign in’ ) # I want to test it

info( ‘signed in’ ) # I don’t care about it

spec:

@scraper.should_receive( :info ).with( ‘attempting to sign in’
).at_least( 1 ).times

result:
expected :info with (“attempting to sign in”) but received it with
(“signed in”)

question:
This is strange. How to test if method was called with specific argument
AND don’t care about other possible calls of that method?

On Tue, Jul 15, 2008 at 3:00 AM, Piotr W. [email protected]
wrote:

).at_least( 1 ).times

result:
expected :info with (“attempting to sign in”) but received it with
(“signed in”)

question:
This is strange.

This is normal :slight_smile: It’s how most mock frameworks work because most of
the time we want to know if unexpected calls start showing up.

How to test if method was called with specific argument
AND don’t care about other possible calls of that method?

@scraper.stub!(:info)
@scraper.should_receive(:info).with(“attempting to sign in”)

Cheers,
David

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs