Search code examples
iosunit-testingprimitive-typesocmockcgsize

OCMock passing any CGSize


I'm using OCMock and I'm trying to do to something like this in one of my tests:

[[mockScrollView expect] setContentSize:[OCMArg any]];

The problem is that [OCMArg any] returns an id type, and I want to use any CGSize, because I don't know it's exact value. How can I pass this argument?


Solution

  • With version 2.2 of OCMock you can use ignoringNonObjectArgs

    [[mockScrollView expect] ignoringNonObjectArgs] setContentSize:dummySize];