Skip to content

Checking that a method was called twice with different values #326

Open
@JamieREvans

Description

I'm trying to verify that a method gets called twice with specific values, but I can't seem to verify both calls, just the first. I have verified that the method is called twice and that the values are correct, but I'm not sure how to write the cedar spec.

Here is what I have:

        it(@"should call sleep with time intervals of 0 and 5", ^{

            // subject is a spied on object
            subject should have_received(@selector(someMethod:)).with(0); // Passes
            subject should have_received(@selector(someMethod:)).with(5); // Fails
        }  

The error I'm getting is this:

Expected <MyObject> to have received message <someMethod:>, with arguments: <5> but received messages:
  someMethod:<0>
  someMethod:<5>

Also, it doesn't seem you can verify that a method was called a specific number of times without overriding the invocation and tracking the count.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions