0

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.

Avi Tsadok
  • 1,843
  • 13
  • 19

1 Answers1

0

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.

Abizern
  • 146,289
  • 39
  • 203
  • 257