Created
October 14, 2014 02:48
-
-
Save keokilee/74b6035f7c446b281452 to your computer and use it in GitHub Desktop.
Kiwi Mocks and Stubs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Kiwi/Kiwi.h> | |
#import “ViewController.h” | |
#import “AFHTTPRequestOperationManager.h” | |
SPEC_BEGIN(MocksControllerSpec) | |
describe(@”ViewController”, ^{ | |
let(controller, ^{return [[UIStoryboard storyboardWithName:@”Main” bundle:nil] instantiateViewControllerWithIdentifier:@”ViewController”]; | |
let(mockManager, ^{return [AFHTTPRequestOperationManager mock];}); | |
beforeEach(^{ | |
[AFHTTPRequestOperationManager stub:@selector(manager) andReturn:mockManager]; | |
}); | |
it(@”fetches using the data.honolulu.gov endpoint”, ^{ | |
KWCaptureSpy *spy = [mockManager captureArgument:@selector(GET:parameters:success:failure☺ atIndex:0]; | |
[controller loadView]; | |
[controller viewDidLoad]; | |
[[[spy argument] should] equal:@”http://data.honolulu.gov/resource/a96q-gyhq.json"]; | |
}); | |
}); | |
SPEC_END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment