Comments (7)
What about this pull request? 'next week' is long ago :)
from amyserver.
Yeah, I thought that too but unfortunately I had the same error as before. That's why I closed this pull request..
from amyserver.
Are you using the use_frameworks!
option in CocoaPods?
from amyserver.
@phatmann Yeah. I've monkey-patched waitForRequestMatchingMocktail
.
func waitForRequestMatching(mocktail mocktail: String, inBundle bundle: NSBundle? = NSBundle.KIFTestBundle(), withHTTPBodyMatchingBlock block: ((NSData, NSErrorPointer) -> KIFTestStepResult)?, andRespondWithValues values: [String: AnyObject]?) {
let response: _AMYMocktailResponse?
let headers: [NSObject: AnyObject]?
let body: NSData?
var errorType = "load mocktail"
do {
response = try _AMYMocktailResponse(fromTail: mocktail, bundle: bundle)
errorType = "generate headers"
headers = try response?.headersWithValues(values)
errorType = "generate body"
body = try response?.bodyWithValues(values)
let request = waitForRequestMatchingBlock { [weak self] (req, error) -> KIFTestStepResult in
return self?.KIFTestWaitCondition(response?.matchesURL(req.URL, method: req.HTTPMethod, patternLength: nil) ?? false, error: error, errorMessage: "Could not find request matching mocktail.") ??
{
block?(req.HTTPBody ?? NSData(), error)
return .Success
}()
}
request.respondWithStatusCode(response?.statusCode ?? 500, headerFields: headers)
request.sendData(body)
request.close()
} catch let error as NSError {
let errorToThrow = NSError(domain: "KIFTest", code: Int(KIFTestStepResult.Failure.rawValue), userInfo: [NSLocalizedDescriptionKey: "Failed to \(errorType): \(error.localizedDescription)", NSUnderlyingErrorKey: error])
failWithError(errorToThrow, stopTest: true)
}
}
and use it like that
//
// IntroTest.swift
// Frip
//
// Created by 최완복 on 2016. 1. 6..
// Copyright © 2016년 Frientrip. All rights reserved.
//
import KIF
class IntroTest: KIFTestCase {
var server: MockingServer { return server() }
override func beforeAll() {
server.start()
}
override func afterAll() {
server.stop()
}
func testSuccess() {
server.waitForRequestMatching(mocktail: "successful-intro", inBundle: NSBundle(forClass: self.dynamicType), andRespondWithValues: nil)
}
}
from amyserver.
Can you submit a pull request with a fix? And be sure to use a new branch for it :-)
from amyserver.
Ok, I'll do it. until next week. ;-)
from amyserver.
Would be closed by #13
from amyserver.
Related Issues (10)
- Support for KIF 2.1.0 and XCTest HOT 1
- Update pod spec to point to kif-framework repo.
- pod trunk push AMYServer.podspec
- Rename AMYServer to KIF.MockServer HOT 2
- Can not install AMYServer 2.0 HOT 1
- Seems to fail if web requests go through when app is first loaded HOT 1
- GRMustacheAvailabilityMacros_private.h not found HOT 1
- addRequestForProtocol won't be called. with Alamofire HOT 2
- AMYServer compatibility with KIF 3.5.1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amyserver.