diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2016-02-25 14:23:56 -0500 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2016-02-25 14:23:56 -0500 |
commit | 7b82da2a560b637562149e6d8ef1b876ab6861fa (patch) | |
tree | 4e6a2cd18edf4b831c0622fbdd1bf4a0a249d447 | |
parent | 12741520edbe2877a59c4ab4520dbaa53897929d (diff) | |
download | sdl_ios-7b82da2a560b637562149e6d8ef1b876ab6861fa.tar.gz |
Fix `SDLPrioritizedObjectCollectionSpec`
-rw-r--r-- | SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/Prioritized Objects/SDLPrioritizedObjectCollectionSpec.m | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/Prioritized Objects/SDLPrioritizedObjectCollectionSpec.m b/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/Prioritized Objects/SDLPrioritizedObjectCollectionSpec.m index d4b1a6674..d417d6d1d 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/Prioritized Objects/SDLPrioritizedObjectCollectionSpec.m +++ b/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/Prioritized Objects/SDLPrioritizedObjectCollectionSpec.m @@ -48,19 +48,29 @@ describe(@"a prioritized object collection", ^{ }); describe(@"should retrieve higher priority objects first", ^{ - NSString *highPriorityString = @"highPriority"; - NSString *mediumPriorityString = @"mediumPriority"; - NSString *lowPriorityString = @"lowPriority"; + __block id firstObjectOut = nil; + __block id secondObjectOut = nil; + __block id thirdObjectOut = nil; - // Add them in "incorrect" order to make sure sorting works correctly. - // Lower numbers indicate higher priority - [collection addObject:mediumPriorityString withPriority:100]; - [collection addObject:lowPriorityString withPriority:200]; - [collection addObject:highPriorityString withPriority:0]; + __block NSString *highPriorityString = nil; + __block NSString *mediumPriorityString = nil; + __block NSString *lowPriorityString = nil; - id firstObjectOut = [collection nextObject]; - id secondObjectOut = [collection nextObject]; - id thirdObjectOut = [collection nextObject]; + beforeEach(^{ + highPriorityString = @"highPriority"; + mediumPriorityString = @"mediumPriority"; + lowPriorityString = @"lowPriority"; + + // Add them in "incorrect" order to make sure sorting works correctly. + // Lower numbers indicate higher priority + [collection addObject:mediumPriorityString withPriority:100]; + [collection addObject:lowPriorityString withPriority:200]; + [collection addObject:highPriorityString withPriority:0]; + + firstObjectOut = [collection nextObject]; + secondObjectOut = [collection nextObject]; + thirdObjectOut = [collection nextObject]; + }); it(@"should retrieve the highest priority first", ^{ expect(firstObjectOut).to(equal(highPriorityString)); |