{"id":16853142,"url":"https://github.com/devxoul/stubber","last_synced_at":"2025-03-17T05:32:11.616Z","repository":{"id":56625069,"uuid":"98500894","full_name":"devxoul/Stubber","owner":"devxoul","description":"A minimal method stub for Swift","archived":false,"fork":false,"pushed_at":"2020-10-28T06:11:02.000Z","size":37,"stargazers_count":89,"open_issues_count":2,"forks_count":12,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-27T18:13:45.510Z","etag":null,"topics":["stub","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devxoul.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-27T06:21:25.000Z","updated_at":"2024-05-09T10:02:01.000Z","dependencies_parsed_at":"2022-08-15T22:10:32.655Z","dependency_job_id":null,"html_url":"https://github.com/devxoul/Stubber","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2FStubber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2FStubber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2FStubber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2FStubber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devxoul","download_url":"https://codeload.github.com/devxoul/Stubber/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243846976,"owners_count":20357294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["stub","swift"],"created_at":"2024-10-13T13:49:53.909Z","updated_at":"2025-03-17T05:32:11.142Z","avatar_url":"https://github.com/devxoul.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stubber\n\n![Swift](https://img.shields.io/badge/Swift-5.0-orange.svg)\n[![CocoaPods](http://img.shields.io/cocoapods/v/Stubber.svg)](https://cocoapods.org/pods/Stubber)\n[![Build Status](https://travis-ci.org/devxoul/Stubber.svg?branch=master)](https://travis-ci.org/devxoul/Stubber)\n[![Codecov](https://img.shields.io/codecov/c/github/devxoul/Stubber.svg)](https://codecov.io/gh/devxoul/Stubber)\n\nA minimal method stub for Swift.\n\n## At a Glance\n\n```swift\nimport Stubber\n\nfinal class StubUserService: UserServiceProtocol {\n  func follow(userID: Int) -\u003e String {\n    return Stubber.invoke(follow, args: userID)\n  }\n\n  func edit(userID: Int, name: String) -\u003e Bool {\n    return Stubber.invoke(edit, args: (userID, name))\n  }\n}\n\nfunc testMethodCall() {\n  // given \n  let userService = StubUserService()\n  Stubber.register(userService.follow) { userID in \"stub-\\(userID)\" } // stub\n  \n  // when\n  userService.follow(userID: 123) // call\n  \n  // then\n  XCTAssertEqual(Stubber.executions(userService.follow).count, 1)\n  XCTAssertEqual(Stubber.executions(userService.follow)[0].arguments, 123)\n  XCTAssertEqual(Stubber.executions(userService.follow)[0].result, \"stub-123\")\n}\n```\n\n## Escaping Parameters\n\nWhen a function contains an escaped parameter, use `escaping()` on arguments.\n\n```diff\n func request(path: String, completion: @escaping (Result) -\u003e Void) {\n-  Stubber.invoke(request, args: (path, completion))\n+  Stubber.invoke(request, args: escaping(path, completion))\n }\n```\n\n## Installation\n\n```ruby\npod 'Stubber'\n```\n\n## License\n\nStubber is under MIT license. See the [LICENSE](LICENSE) for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevxoul%2Fstubber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevxoul%2Fstubber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevxoul%2Fstubber/lists"}