Skip to content
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

Closed
wants to merge 22 commits into from

Conversation

dgyesbreghs
Copy link
Contributor

#12

Copy link
Collaborator

@fousa fousa left a 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.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
}

override func spec() {
describe("CodableSerializer") {
Copy link
Collaborator

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.

Copy link
Contributor Author

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 🙂

Example/Podfile Show resolved Hide resolved
@fousa fousa deleted the feature/12-connectivity branch April 26, 2019 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants