-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate Connectivity + Example Project #16
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not make a separate class that a user should use. I would try to add it to the Service
.
} | ||
|
||
override func spec() { | ||
describe("CodableSerializer") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mostly do when testing external libraries like these. I create a mock object like you did above and I stub all the methods that could potentially be called by Cara.
ex.
class MockedNetworkReachability: NetworkReachability {
private(set) var didTriggerStartListening: Bool = false
override func startListening() {
didTriggerStartListening = true
}
}
Here is what I test:
it("should trigger start listening") {
service.theFunctionThatTriggersStartListening()
expect(networkReachability.didTriggerStartListening) == true
}
I would not trigger it on the mocked object though. What I would do in this case I would create a MockedConnectivity
and test if the correct method is triggered on that class.
If it's unclear, I can show you in one of my projects somewhere this week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made a couple of changes, but it will be useful if you can show a example next week 🙂
#12