All Projects → devxoul → Stubber

devxoul / Stubber

Licence: MIT license
A minimal method stub for Swift

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language
HTML
75241 projects

Labels

Projects that are alternatives of or similar to Stubber

Mockery
Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL).
Stars: ✭ 10,048 (+12153.66%)
Mutual labels:  stub
mocka
Mocka - The complete testing framework for LUA and Nginx
Stars: ✭ 26 (-68.29%)
Mutual labels:  stub
ts-mock-imports
Intuitive mocking library for Typescript class imports
Stars: ✭ 103 (+25.61%)
Mutual labels:  stub
Netclient Ios
Versatile HTTP Networking in Swift
Stars: ✭ 117 (+42.68%)
Mutual labels:  stub
Sbtuitesttunnel
Enable network mocks and more in UI Tests
Stars: ✭ 215 (+162.2%)
Mutual labels:  stub
Wilma
Service Virtualization Solution – a combined Service Stub and Transparent Proxy
Stars: ✭ 50 (-39.02%)
Mutual labels:  stub
Impersonator
Ruby library to record and replay object interactions
Stars: ✭ 100 (+21.95%)
Mutual labels:  stub
sinon-mongoose
Extend Sinon stubs for Mongoose methods to test chained methods easily
Stars: ✭ 87 (+6.1%)
Mutual labels:  stub
Restito
Restito - mocking framework for testing rest clients
Stars: ✭ 217 (+164.63%)
Mutual labels:  stub
odoo-stubs
Python Stubs for Odoo
Stars: ✭ 40 (-51.22%)
Mutual labels:  stub
Spy
Clojure/ClojureScript library for stubs, spies and mocks.
Stars: ✭ 131 (+59.76%)
Mutual labels:  stub
Typeshed
Typeshed contains external type annotations for the Python standard library and Python builtins, as well as third party packages as contributed by people external to those projects.
Stars: ✭ 2,501 (+2950%)
Mutual labels:  stub
extensions
Code Generators and Extensions for vanilla-rtb stack
Stars: ✭ 16 (-80.49%)
Mutual labels:  stub
Mockit
A tool to quickly mock out end points, setup delays and more...
Stars: ✭ 1,534 (+1770.73%)
Mutual labels:  stub
stub on web
Create stub urls to test external API integration
Stars: ✭ 54 (-34.15%)
Mutual labels:  stub
Mimic
A mocking library for Elixir
Stars: ✭ 104 (+26.83%)
Mutual labels:  stub
aem-stubs
Tool for providing sample data for AEM applications in a simple and flexible way. Stubbing server on AEM, no separate needed.
Stars: ✭ 40 (-51.22%)
Mutual labels:  stub
FireMock
Mock and stub HTTP requests. Test your apps with fake data and files responses.
Stars: ✭ 25 (-69.51%)
Mutual labels:  stub
laravel-repository-pattern
Files autogenerator for repositorry pattern
Stars: ✭ 46 (-43.9%)
Mutual labels:  stub
babel-plugin-rewire-exports
Babel plugin for stubbing [ES6, ES2015] module exports
Stars: ✭ 62 (-24.39%)
Mutual labels:  stub

Stubber

Swift CocoaPods Build Status Codecov

A minimal method stub for Swift.

At a Glance

import Stubber

final class StubUserService: UserServiceProtocol {
  func follow(userID: Int) -> String {
    return Stubber.invoke(follow, args: userID)
  }

  func edit(userID: Int, name: String) -> Bool {
    return Stubber.invoke(edit, args: (userID, name))
  }
}

func testMethodCall() {
  // given 
  let userService = StubUserService()
  Stubber.register(userService.follow) { userID in "stub-\(userID)" } // stub
  
  // when
  userService.follow(userID: 123) // call
  
  // then
  XCTAssertEqual(Stubber.executions(userService.follow).count, 1)
  XCTAssertEqual(Stubber.executions(userService.follow)[0].arguments, 123)
  XCTAssertEqual(Stubber.executions(userService.follow)[0].result, "stub-123")
}

Escaping Parameters

When a function contains an escaped parameter, use escaping() on arguments.

 func request(path: String, completion: @escaping (Result) -> Void) {
-  Stubber.invoke(request, args: (path, completion))
+  Stubber.invoke(request, args: escaping(path, completion))
 }

Installation

pod 'Stubber'

License

Stubber is under MIT license. See the LICENSE for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].