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

Add XCTest extensions #57

Merged
merged 3 commits into from
May 29, 2020
Merged

Add XCTest extensions #57

merged 3 commits into from
May 29, 2020

Conversation

AvdLee
Copy link
Contributor

@AvdLee AvdLee commented May 27, 2020

This PR adds two extensions that allow easy usage in XCTests:

var mock = Mock(url: url, dataType: .json, statusCode: 200, data: [.get: Data()])
let requestExpectation = expectationForCompletingMock(&mock)
let completionExpectation = expectationForCompletingMock(&mock)
mock.register()

URLSession.shared.dataTask(with: URLRequest(url: url)).resume()

wait(for: [requestExpectation, completionExpectation], timeout: 2.0)

@AvdLee AvdLee self-assigned this May 27, 2020
@ghost
Copy link

ghost commented May 27, 2020

Warnings
⚠️

Consider to place some MARK: lines for Sources/Mock.swift, which is over 200 lines big.

Messages
📖

View more details on Bitrise

📖 Mocker: Executed 20 tests, with 0 failures (0 unexpected) in 1.799 (1.887) seconds

Mocker.framework: Coverage: 89.51

File Coverage
Mock.swift 84.62%
XCTest+Mocker.swift 100.0%
MockingURLProtocol.swift 86.54%

Generated by 🚫 Danger Swift against 8c0e983

Copy link

@Boris-Em Boris-Em left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Convenient

Copy link
Contributor

@kairadiagne kairadiagne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handy!

@AvdLee AvdLee merged commit 2128c42 into master May 29, 2020
@AvdLee AvdLee deleted the feature/xctest-extensions branch May 29, 2020 06:54
@ghost
Copy link

ghost commented May 29, 2020

Congratulations! 🎉 This was released as part of Release 2.3.0 🚀

Generated by GitBuddy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants