summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/Requests/SDLRPCRequestNotificationSpec.m
blob: 4751c93611c631fd93364e9559061512d70a895b (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
//
//  SDLRPCRequestNotificationSpec.m
//  SmartDeviceLinkTests
//
//  Created by Nicole on 2/14/19.
//  Copyright © 2019 smartdevicelink. All rights reserved.
//

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

#import "SDLNotificationConstants.h"
#import "SDLAddCommand.h"
#import "SDLRPCRequestNotification.h"


QuickSpecBegin(SDLRPCRequestNotificationSpec)

describe(@"A request notification", ^{
    __block SDLRPCRequest *testRequest = nil;
    __block NSString *testName = nil;

    beforeEach(^{
        testRequest = [[SDLAddCommand alloc] initWithName:@"testRequest"];
        testName = SDLDidReceiveAddCommandResponse;
    });

    it(@"Should initialize correctly with initWithName:object:rpcRequest:", ^{
        SDLRPCRequestNotification *testNotification = [[SDLRPCRequestNotification alloc] initWithName:testName object:nil rpcRequest:testRequest];

        expect(testNotification.name).to(equal(testName));
        expect(testNotification.userInfo).to(equal(@{SDLNotificationUserInfoObject: testRequest}));
        expect(testNotification.object).to(beNil());
        expect(testNotification.request).to(equal(testRequest));
        expect([testNotification isRequestKindOfClass:SDLRPCRequest.class]).to(beTrue());
        expect([testNotification isRequestMemberOfClass:SDLAddCommand.class]).to(beTrue());
    });
});

QuickSpecEnd