Kiwi is a Behavior Driven Development library for iOS development.
The idea behind Kiwi is to have unit tests readable and simple to implement.
The tests are written in Objective-C and run in Xcode to provide a test environment that is as unobtrusive and simple as possible in terms of test execution and error reporting.

#import "Kiwi.h"
#import "ChangeSearchParameterViewController.h"
#import "ChangeSearchParameterViewController+SBTPrivate.h"

SPEC_BEGIN(KiwiChangeSearchParameterTests)

describe(@"Change search parameter controller", ^{
   context(@"when created", ^{
       NSManagedObjectContext *moc = [Model setupCoreDataStackWithInMemoryStoreAndLoadConfiguration];
       Search *search = [Search baseObjectInContext:moc];
       
       id fakeDelegate = [KWMock mockForProtocol:@protocol(ChangeSearchParameterViewControllerDelegate)];
       
       ChangeSearchParameterViewController *changeSearchParameterViewController = [[ChangeSearchParameterViewController alloc] initWithSearch:search];
       changeSearchParameterViewController.delegate = fakeDelegate;
       
       it(@"should not be nil", ^{
           [[changeSearchParameterViewController should] beNonNil];
       });
       it(@"should has delegate equal to fakeDelegate", ^{
           [[fakeDelegate should] equal:changeSearchParameterViewController.delegate];
       });
       context(@"when dismissed", ^{
           it(@"should call delegate", ^{
               [[fakeDelegate should] respondToSelector:@selector(changeSearchParameterDidFinish:modifiedSearch:changedParameters:)];
               [[fakeDelegate should] receive:@selector(changeSearchParameterDidFinish:modifiedSearch:changedParameters:)];
               [changeSearchParameterViewController notifyDelegateAndDismiss];
           });
       });
   });
});

SPEC_END

Kiwi site

share me!:))Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone
Print this page