View gist:441ea71c8c0fd69bca58
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
func fetchNotificationsNotMatchingEtag(etag: String?, includeReadNotifications includeRead: Bool, updatedSince since: NSDate?) -> SignalProducer<OCTResponse, NSError> { | |
let signal = fetchNotificationsNotMatchingEtag(etag, includeReadNotifications: includeRead, updatedSince: since) | |
return signal.toSignalProducer() | |
|> map { $0 as! OCTResponse } | |
} |
View gist:2001574
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
it(@"should start the processing with the ids from the network response", ^{ | |
// mock network request | |
[KWSpec canResponseJSON:@"ids"]; | |
// execute code under test | |
[client syncMyStuff]; | |
// create mock | |
id process = [ProcessingOperation mock]; | |
// return mock by stubbing alloc |
View gist:5781595
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
context(@"success", ^{ | |
beforeEach(^{ | |
[OHHTTPStubs shouldStubRequestsPassingTest:^BOOL(NSURLRequest *request) { | |
NSString *expectedPath = @"/3/configuration"; | |
BOOL shouldStub = [[request.URL path] isEqualToString:expectedPath]; | |
return shouldStub; | |
} withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) { | |
OHHTTPStubsResponse *response = [OHHTTPStubsResponse responseWithFile:@"configuration.json" | |
contentType:@"application/json" |
View gist:6187127
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
UIView *scrollViewWidthEnforcer = [UIView new]; | |
[scrollViewWidthEnforcer setTranslatesAutoresizingMaskIntoConstraints:NO]; | |
[self.scrollView addSubview:scrollViewWidthEnforcer]; | |
[self.scrollView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[enforcer(==scrollView)]|" | |
options:0 | |
metrics:nil | |
views:@{ | |
@"enforcer" : scrollViewWidthEnforcer, | |
@"scrollView" : self.scrollView | |
}]]; |
View XCTestCase+OCUnitCompatibility.m
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
- (void)failWithException:(NSException *)exception | |
{ | |
NSRange firstColonRange = [exception.reason rangeOfString:@":"]; | |
NSString *filename = [exception.reason substringToIndex:firstColonRange.location]; | |
NSString *secondPart = [exception.reason substringFromIndex:firstColonRange.location + firstColonRange.length]; | |
NSRange lineSeparatorRange = [secondPart rangeOfString:@" "]; | |
NSString *lineString = [secondPart substringToIndex:lineSeparatorRange.location]; |
View NSFileManager+DoNotBackup.h
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
@interface NSFileManager (DoNotBackup) | |
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL; | |
@end |