Reputation: 1843
I'm trying to use Specta as my unit testing framework (Instead of Kiwi). How can I test if an object receives a selector Let's say 5 times, like I do in Kiwi?
In other words, what is the equivalent to this 'Kiwi' line of code:
[[sut should] receive:@selector(showUpsellIfNeededForFile) withCount:5];
Thanks in advance.
Upvotes: 0
Views: 67
Reputation: 150715
What you are looking for is the functionality provided by OCMock, which doesn't work with Swift.
But, more importantly, do you really need to test whether a particular function is called? You've just coupled your application code to your test code.
I've used Specta and Expecta in the past and stopped using such mock tests. Rather I use it as it is meant to be used - Behavioural testing. I test that the code I am running results in a required behaviour rather than whether or not specific subsidiary methods are called during the test.
Upvotes: 0