Skip to content

Instantly share code, notes, and snippets.

@yas375
Forked from delebedev/test
Last active December 30, 2015 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yas375/7801725 to your computer and use it in GitHub Desktop.
Save yas375/7801725 to your computer and use it in GitHub Desktop.
#import <Kiwi/Kiwi.h>
#import "WGTitleView.h"
@interface WGTitleView ()
@property (strong, nonatomic) UILabel *titleLabel;
@property (strong, nonatomic) UILabel *subtitleLabel;
- (void)onTap:(id)sender;
@end
SPEC_BEGIN(WGTitleViewSpec)
describe(@"WGTitleView", ^{
it(@"can be created without title and subtitle", ^{
WGTitleView *titleView = [WGTitleView titleView];
[[titleView.title should] beNil];
[[titleView.subtitle should] beNil];
});
it(@"can be created with title only", ^{
WGTitleView *titleView = [WGTitleView titleViewWithTitle:@"title"];
[[titleView.title should] equal:@"title"];
[[titleView.subtitle should] beNil];
});
context(@"when created with title and subtitle", ^{
__block WGTitleView *titleView = nil;
beforeEach(^{
titleView = [WGTitleView titleViewWithTitle:@"title" subtitle:@"subtitle"];
});
it(@"has title and subtitle", ^{
[[titleView.title should] equal:@"title"];
[[titleView.subtitle should] equal:@"subtitle"];
});
it(@"has appropriate title and subtitle on the labels labels", ^{
[[titleView.titleLabel.text should] equal:@"title"];
[[titleView.subtitleLabel.text should] equal:@"subtitle"];
});
it(@"call tap handle on tap", ^{
__block BOOL tapped = NO;
titleView.tapHandler = ^(){
tapped = YES;
};
[titleView onTap:nil];
[[theValue(tapped) should] beTrue];
});
});
});
SPEC_END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment