|
7 | 7 | #import "PBGitWindowController.h" |
8 | 8 | #import "PBGitRepository.h" |
9 | 9 | #import "PBGitSidebarController.h" |
| 10 | +#import "PBGitDefaults.h" |
10 | 11 | #import "PBGitHistoryController.h" |
11 | 12 | #import "PBGitHistoryList.h" |
12 | 13 | #import "PBGitCommit.h" |
@@ -38,6 +39,7 @@ - (PBGitRepository *)repository |
38 | 39 | @interface PBGitWindowWiringTests : XCTestCase |
39 | 40 | @property (nonatomic, strong) PBStubWindowController *windowController; |
40 | 41 | @property (nonatomic, strong) NSURL *repositoryURL; |
| 42 | +@property (nonatomic, strong) id settingToPutBack; |
41 | 43 | @end |
42 | 44 |
|
43 | 45 | @implementation PBGitWindowWiringTests |
@@ -88,6 +90,14 @@ - (void)setUp |
88 | 90 | { |
89 | 91 | [super setUp]; |
90 | 92 |
|
| 93 | + // The sidebar opens whichever view this preference names, and the window |
| 94 | + // loads a nib only for the controller it shows, so a GitX left on the stage |
| 95 | + // view would leave the history list and its array controller nil here. The |
| 96 | + // tests run in the application, so put back what was there afterwards. |
| 97 | + self.settingToPutBack = [[NSUserDefaults standardUserDefaults] objectForKey:@"PBShowStageView"]; |
| 98 | + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"PBShowStageView"]; |
| 99 | + XCTAssertFalse([PBGitDefaults showStageView], @"the preference this suite turns off is read under some other name now, so it is no longer being turned off"); |
| 100 | + |
91 | 101 | self.repositoryURL = [self makeRepository]; |
92 | 102 |
|
93 | 103 | NSError *error = nil; |
@@ -126,6 +136,11 @@ - (void)tearDown |
126 | 136 | self.windowController = nil; |
127 | 137 | [[NSFileManager defaultManager] removeItemAtURL:self.repositoryURL error:NULL]; |
128 | 138 |
|
| 139 | + if (self.settingToPutBack) |
| 140 | + [[NSUserDefaults standardUserDefaults] setObject:self.settingToPutBack forKey:@"PBShowStageView"]; |
| 141 | + else |
| 142 | + [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"PBShowStageView"]; |
| 143 | + |
129 | 144 | [super tearDown]; |
130 | 145 | } |
131 | 146 |
|
|
0 commit comments