iOS-FakeWeb 0.1.1

iOS-FakeWeb 0.1.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2015

Maintained by Unclaimed.



  • By
  • Toshihiro Morimoto

FakeWeb

Simple HTTP request mocking/interception for testing module.

Inspired by chrisk's fakeweb.

Requirements

  • Xcode 4.x
  • LLVM compiler recommended.
  • only ARC

installation

  • get iOS-FakeWeb project.
  • some include and implemantation file into your project.

Required files on to use this library

   FakeWeb.h
   FakeWeb.m
   FakeWebResponder.h
   FakeWebResponder.m
   FakeWeb+Private.h

If you use HTTP Library "ASIHTTPRequest", add this file.

   ASIHTTPRequest+FakeWeb.h
   ASIHTTPRequest+FakeWeb.m

If you use HTTP Library "NSURLConnection", add this file.

   NSURLConnection+FakeWeb.h
   NSURLConnection+FakeWeb.m

※ If you use other HTTP Libaray depends on "NSURLConnection", this is to solve it by using this "NSURLConnection+FakeWeb.h".

Usage

simple case:

#import "FakeWeb.h"

NSString *urlString = @"http://google.com";
[FakeWeb registerUri:urlString method:@"GET" body:@"hoge" staus:200];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:urlString]];
[request startSynchronous];
NSLog(@"%@", [request responseString]);
// => hoge

Other uses will see the test case: FakeWebTests/Spec/FakeWebAHIHTTPRequestSpec.m or FakeWebTests/Spec/FakeWebNSURLConnectionSpec.m

Contact

Creators

Toshihiro Morimoto @dealforest

Changes

The details are described in CHANGES.

License

MIT, the license agreement found in License.txt.