{"id":22112397,"url":"https://github.com/lukeredpath/lrmimic","last_synced_at":"2025-07-25T07:32:56.232Z","repository":{"id":2675047,"uuid":"3667012","full_name":"lukeredpath/LRMimic","owner":"lukeredpath","description":"An Objective-C client for the Mimic REST API","archived":false,"fork":false,"pushed_at":"2012-03-09T04:10:38.000Z","size":117,"stargazers_count":17,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-04-09T05:47:29.858Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/lukeredpath.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":"2012-03-09T03:14:06.000Z","updated_at":"2022-01-18T01:58:21.000Z","dependencies_parsed_at":"2022-07-25T01:16:06.976Z","dependency_job_id":null,"html_url":"https://github.com/lukeredpath/LRMimic","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeredpath%2FLRMimic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeredpath%2FLRMimic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeredpath%2FLRMimic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeredpath%2FLRMimic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukeredpath","download_url":"https://codeload.github.com/lukeredpath/LRMimic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227544094,"owners_count":17785198,"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":[],"created_at":"2024-12-01T10:57:49.383Z","updated_at":"2024-12-01T10:57:50.037Z","avatar_url":"https://github.com/lukeredpath.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LRMimic, an Objective-C interface for Mimic\n\n[Mimic](http://github.com/lukeredpath/mimic) is a Ruby gem that allows you to create live server stubs for your end-to-end tests.\n\nWhilst Mimic is written in Ruby, it can be run as a standalone component without any pre-configured request stubs and be configured dynamically using it's embedded REST API (see the Mimic README for more information).\n\nMimic currently used to ship with a rough implementation of an Objective-C wrapper for it's REST API. This is an attempt to build a better, more fluent API.\n\n## Usage\n\nIn order to keep tests as deterministic as possible, Mimic runs entirely synchronously. You'll probably never have any reason to use this in anything other than your tests, but if you do you should bear that in mind. As it's communicating with a local server, it's pretty fast anyway.\n\nUsing LRMimic requires that a mimic daemon is running (see the Mimic README on how to do this). You may want to start and stop this before and after your tests by using Xcode pre and post actions for your scheme's Test action.\n\n### Creating a new Mimic client\n\n```objc\nNSURL *serverURL = [NSURL URLWithString:@\"http://localhost:9999\"]\nLRMimic *mimic = [[LRMimic alloc] initWithServerURL:serverURL];\n```\n\n### Stubbing a GET request\n\n```objc\n[mimic respondTo:^(LRMimicStub *stub) {\n  [stub get:@\"/example\" itReturns:^(LRMimicStubResponse *response) {}];\n}];\n```\n\nThis will create a default response stub for `GET /example` requests, returning a 200 OK and an empty response body.\n\n### Customising your stub responses\n\n```objc\n[mimic respondTo:^(LRMimicStub *stub) {\n  [stub get:@\"/example\" itReturns:^(LRMimicStubResponse *response) {\n    [response setStatus:200];\n    [response setBody:@\"This is my response\"];\n    [response setValue:@\"text/plain\" forHTTPHeaderField:@\"Content-Type\"];\n  }];\n}];\n```\n\n### Configuring a stub to return an object as JSON (iOS 5 only)\n\n```objc\n[mimic respondTo:^(LRMimicStub *stub) {\n  [stub get:@\"/example\" itReturns:^(LRMimicStubResponse *response) {\n    [response setStatus:200];\n    [response setJSONBody:[NSDictionary dictionaryWithObject:@\"bar\" forKey:@\"foo\"]];\n  }];\n}];\n```\n\nThis will convert the object to a JSON string using `NSJSONSerialization`, set it as the response body and configure the response `Content-Type` to be `application/json`.\n\n### What about non-GET requests?\n\nLRMimic has methods for stubbing GET, POST, PUT and DELETE requests. See `LRMimic.h` for details.\n\n## License\n\nThis is licensed under the same license as `mimic`, which is the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeredpath%2Flrmimic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukeredpath%2Flrmimic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeredpath%2Flrmimic/lists"}