-
Notifications
You must be signed in to change notification settings - Fork 20
/
StarRatingViewTests.m
53 lines (41 loc) · 1.15 KB
/
StarRatingViewTests.m
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
//
// StarRatingViewTests.m
// StarRatingViewTests
//
// Created by liaojinxing on 14-5-4.
// Copyright (c) 2014年 jinxing. All rights reserved.
//
SpecBegin(StarRatingView)
__block StarRatingView* view;
beforeEach(^{
view = [[StarRatingView alloc] initWithFrame:CGRectMake(0, 0, 200, 100)];
});
describe(@"rating", ^{
it(@"defaults to zero", ^{
expect(view.rating).to.equal(0);
});
it(@"can be set", ^{
view.rating = 3.5f;
expect(view.rating).to.equal(3.5f);
});
it(@"displays no stars", ^{
expect(view).to.haveValidSnapshotNamed(@"noStars");
});
it(@"displays half a star", ^{
view.rating = 0.5f;
expect(view).to.haveValidSnapshotNamed(@"halfStar");
});
it(@"displays one star", ^{
view.rating = 1.0f;
expect(view).to.haveValidSnapshotNamed(@"oneStar");
});
it(@"displays five stars", ^{
view.rating = 5.0f;
expect(view).to.haveValidSnapshotNamed(@"fiveStars");
});
it(@"displays half stars", ^{
view.rating = 3.5f;
expect(view).to.haveValidSnapshotNamed(@"threePointFiveStars");
});
});
SpecEnd