Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriydyrenko committed Mar 22, 2014
1 parent e2a7a97 commit 7c48553
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Project Barbosa/PBHTTPSessionManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ @implementation PBHTTPSessionManager

+ (instancetype)manager
{
NSURL *baseURL = [NSURL URLWithString:@"http://localhost:3000/"];
//NSURL *baseURL = [NSURL URLWithString:@"http://project-barbosa.herokuapp.com/"];
//NSURL *baseURL = [NSURL URLWithString:@"http://localhost:3000/"];
NSURL *baseURL = [NSURL URLWithString:@"http://project-barbosa.herokuapp.com"];
PBHTTPSessionManager *manager = [[[self class] alloc] initWithBaseURL:baseURL];

return manager;
Expand Down
5 changes: 4 additions & 1 deletion Project Barbosa/PBTripManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ + (void)getTripsFromPath:(NSString *)path parameters:(NSDictionary *)parameters

+ (void)storeSavedTrips:(NSArray *)trips
{
[[NSUserDefaults standardUserDefaults] setObject:trips forKey:kSavedTrips];
if([trips isKindOfClass:[NSArray class]] || [trips isKindOfClass:[NSMutableArray class]])
{
[[NSUserDefaults standardUserDefaults] setObject:trips forKey:kSavedTrips];
}
}

+ (NSArray *)loadSavedTrips
Expand Down
22 changes: 22 additions & 0 deletions Project BarbosaTests/PBTripManager_Tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,28 @@

[[expectFutureValue(allTrips) shouldEventuallyBeforeTimingOutAfter(4.0)] beNonNil];
});

it(@"should store and return a nil value", ^{
NSArray *nilArray = nil;
[PBTripManager storeSavedTrips:nilArray];
nilArray = [PBTripManager loadSavedTrips];
[[nilArray should] beNil];
});

it(@"should save an empty array and delete it", ^{
NSArray *empty = [[NSArray alloc] initWithObjects:nil, nil];
NSArray *saved = nil;
[PBTripManager storeSavedTrips:empty];

saved = [PBTripManager loadSavedTrips];

[[saved should] beNonNil];
[[theValue(saved.count) should] equal:theValue(0)];

[PBTripManager removeSavedTrips];
saved = [PBTripManager loadSavedTrips];
[[saved should] beNil];
});
});

SPEC_END
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>843602D5-AAB5-42DE-A97F-93D7A1061FF7</string>
<string>40364B02-9390-4844-9BBA-FAAB78C5F9BF</string>
<key>IDESourceControlProjectName</key>
<string>ProjectBarbosa</string>
<key>IDESourceControlProjectOriginsDictionary</key>
Expand Down

0 comments on commit 7c48553

Please sign in to comment.