summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLHMICapabilitiesSpec.m
blob: 4121992dfe31f998210aa6b86652e2fcd94199ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
//  SDLHMICapabilitiesSpec.m
//  SmartDeviceLink-iOS
//

#import <Quick/Quick.h>
#import <Nimble/Nimble.h>

#import "SDLHMICapabilities.h"
#import "SDLNames.h"


QuickSpecBegin(SDLHMICapabilitiesSpec)

describe(@"SDLHMICapabilities struct", ^{
    __block SDLHMICapabilities *testStruct = nil;
    __block NSNumber *somePhoneCallState = @NO;
    __block NSNumber *someNavigationState = @YES;
    
    context(@"When initialized with properties", ^{
        beforeEach(^{
            testStruct = [[SDLHMICapabilities alloc] init];
            testStruct.phoneCall = somePhoneCallState;
            testStruct.navigation = someNavigationState;
        });
        
        it(@"should properly set phone call", ^{
            expect(testStruct.phoneCall).to(equal(somePhoneCallState));
        });
        
        it(@"should properly set navigation", ^{
            expect(testStruct.navigation).to(equal(someNavigationState));
        });
    });
    
    context(@"When initialized with a dictionary", ^{
        beforeEach(^{
            NSDictionary *structInitDict = @{
                                             SDLNameNavigation: someNavigationState,
                                             SDLNamePhoneCall: somePhoneCallState
                                             };
            testStruct = [[SDLHMICapabilities alloc] initWithDictionary:[structInitDict mutableCopy]];
        });
        
        it(@"should properly set phone call", ^{
            expect(testStruct.phoneCall).to(equal(somePhoneCallState));
        });
        
        it(@"should properly set navigation", ^{
            expect(testStruct.navigation).to(equal(someNavigationState));
        });
    });
    
    context(@"When not initialized", ^{
        beforeEach(^{
            testStruct = nil;
        });
        
        it(@"phoneCall should be nil", ^{
            expect(testStruct.phoneCall).to(beNil());
        });
        
        it(@"navigation should be nil", ^{
            expect(testStruct.navigation).to(beNil());
        });
    });
});

QuickSpecEnd