Latest 0.1.0
License MIT
Platforms ios 8.0, osx 10.9, requires ARC
Dependencies Representor, Mockingjay
Frameworks XCTest

Framework for stubbing Hypermedia HTTP requests. Making use of
Mockingjay and the
Swift Representor.


Mockingdrive can be used to stub any requests matching a Mockingjay matcher by
a Representor. Here’s an example of using the Representor builder pattern:

stubRepresentor(uri("/questions")) {
  $0.addTransition("next", uri: "/questions?page=2")
  $0.addAttribute("count", value: 22)

You can also pass in directory a representor structure:

stub(everything, representor)

Full example using the Hyperdrive Hypermedia client.

class QuestionTests : XCTestCase {
  let hyperdrive = Hyperdrive()

  func testQuestions() {
    // Stub /questions using the Representor builder pattern
    stubRepresentor(uri("/questions")) {
      $0.addTransition("next", uri:"/questions?page=2")
      $0.addAttribute("count", value: 22)

    // Use an XCTest expectation, so our tests wait for the request to finish
    let expectation = expectationWithDescription("Mockingdrive")

    // Perform request (using Hyperdrive, you can use other networking libraries)
    hyperdrive.enter("") { result in
      switch result {
      case .Success(let representor):
        // Assert we have a transition for using the "next" relation
      case .Failure:
        XCTFail("Unexpected Failure")

    waitForExpectationsWithTimeout(1.0, handler: nil)


CocoaPods is the recommended way to add Mockingdrive
to your project.

pod 'Mockingdrive'


Mockingdrive is released under the MIT license. See LICENSE.

Latest podspec

    "name": "Mockingdrive",
    "version": "0.1.0",
    "summary": "Testing framework for stubbing Hypermedia HTTP requests",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Kyle Fuller": "[email protected]"
    "social_media_url": "",
    "source": {
        "git": "",
        "tag": "0.1.0"
    "source_files": "Mockingdrive/*.{h,swift}",
    "frameworks": "XCTest",
    "platforms": {
        "ios": "8.0",
        "osx": "10.9"
    "requires_arc": true,
    "dependencies": {
        "Representor": [],
        "Mockingjay": [
            "~> 1.0"

Pin It on Pinterest

Share This