ThinkChris
ThinkChris

Reputation: 1179

Test JASidePanels with Kiwi

I am trying JASidePanels with Kiwi, and got following error:

failed: 'Root side panel controller, wants to show left panel, shows left panel' [FAILED], expected subject to equal 2, got 1

I think I must made some obvious mistake but could not figure out where. Could any one give me some hints? Thanks in advance.

#import "Kiwi.h"
#import "JASidePanelController.h"
#import "UIViewController+JASidePanel.h"

SPEC_BEGIN(MSISidePanelControllerSpec)

describe(@"Root side panel controller", ^{

    __block JASidePanelController *sidePanelController;

    beforeEach(^{
        sidePanelController = [[JASidePanelController alloc] init];
    });

    context(@"wants to show left panel", ^{

        beforeEach(^{
            [sidePanelController showLeftPanelAnimated:YES];
        });

        it(@"shows left panel", ^{
            [[theValue(sidePanelController.state) should] equal:theValue(JASidePanelLeftVisible)];
        });
    });
});

SPEC_END

Upvotes: 0

Views: 176

Answers (1)

Mike Mertsock
Mike Mertsock

Reputation: 12025

The problem is that your setup code (initializing sidePanelController and sending showLeftPanelAnimated:) are not inside blocks as part of beforeEach or similar functions. See this answer to a similar Kiwi question for details.

Upvotes: 2

Related Questions