Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Commit

Permalink
Merge pull request #227 from octokit/set-nested-repo-server
Browse files Browse the repository at this point in the history
Set PR's nested repo server
  • Loading branch information
jspahrsummers committed Jan 7, 2015
2 parents f9f2155 + 086aace commit 209b090
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions OctoKit/OCTPullRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#import "OCTUser.h"
#import "OCTRepository.h"
#import "NSValueTransformer+OCTPredefinedTransformerAdditions.h"
#import "OCTObject+Private.h"

@implementation OCTPullRequest

Expand Down Expand Up @@ -101,4 +102,11 @@ + (NSValueTransformer *)baseRepositoryJSONTransformer {
return [MTLValueTransformer mtl_JSONDictionaryTransformerWithModelClass:OCTRepository.class];
}

- (void)setBaseURL:(NSURL *)baseURL {
super.baseURL = baseURL;

self.headRepository.baseURL = baseURL;
self.baseRepository.baseURL = baseURL;
}

@end
8 changes: 8 additions & 0 deletions OctoKitTests/OCTPullRequestSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import <Quick/Quick.h>

#import "OCTObjectSpec.h"
#import "OCTObject+Private.h"

QuickSpecBegin(OCTPullRequestSpec)

Expand Down Expand Up @@ -177,4 +178,11 @@
expect(pullRequest.mergedDate).to(equal([[[ISO8601DateFormatter alloc] init] dateFromString:@"2011-01-26T19:04:12Z"]));
});

it(@"should set its nested repository's servers", ^{
NSURL *URL = [NSURL URLWithString:@"https://myserver.com"];
pullRequest.baseURL = URL;
expect(pullRequest.baseRepository.baseURL).to(equal(URL));
expect(pullRequest.headRepository.baseURL).to(equal(URL));
});

QuickSpecEnd

0 comments on commit 209b090

Please sign in to comment.