-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add URL session as configuration property (#127)
- Loading branch information
Showing
10 changed files
with
89 additions
and
13 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// BugsnagConfigurationSpec.m | ||
// Bugsnag | ||
// | ||
// Created by Delisa Mason on 11/30/16. | ||
// Copyright 2016 Bugsnag. All rights reserved. | ||
// | ||
|
||
#import <Kiwi/Kiwi.h> | ||
#import "BugsnagConfiguration.h" | ||
#import "Bugsnag.h" | ||
|
||
@interface SomeDelegate : NSObject<NSURLSessionTaskDelegate> | ||
@property (nonatomic) BOOL didInvoke; | ||
@end | ||
|
||
@implementation SomeDelegate | ||
|
||
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(nonnull NSURLAuthenticationChallenge *)challenge completionHandler:(nonnull void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler { | ||
self.didInvoke = YES; | ||
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil); | ||
} | ||
|
||
@end | ||
|
||
|
||
SPEC_BEGIN(BugsnagConfigurationSpec) | ||
|
||
describe(@"BugsnagConfiguration", ^{ | ||
|
||
it(@"sets the request session", ^{ | ||
SomeDelegate *delegate = [SomeDelegate new]; | ||
BugsnagConfiguration *config = [BugsnagConfiguration new]; | ||
config.session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] | ||
delegate:delegate | ||
delegateQueue:[NSOperationQueue mainQueue]]; | ||
[Bugsnag startBugsnagWithConfiguration:config]; | ||
[Bugsnag notify:[NSException exceptionWithName:@"oh no" reason:nil userInfo:nil]]; | ||
[[expectFutureValue(@(delegate.didInvoke)) shouldEventually] beYes]; | ||
}); | ||
}); | ||
|
||
SPEC_END |
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
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
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
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