Skip to content

Commit 9e86dc1

Browse files
committed
Completed ASHEditRecipeViewModel tests.
1 parent 0e61f0e commit 9e86dc1

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

C-41/ASHEditRecipeViewModel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
-(void)moveStepFromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex;
2727

2828
-(BOOL)shouldShowCancelButton;
29+
2930
-(NSInteger)numberOfSteps;
3031
-(int32_t)filmTypeForSection:(NSInteger)section;
3132
-(NSInteger)sectionForFilmTpe:(int32_t)filmType;

C-41Tests/ASHEditRecipeViewModelTests.m

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#import "CoreDataHelpers.h"
1515

1616
#import "ASHEditRecipeViewModel.h"
17+
#import "ASHEditStepViewModel.h"
1718

1819
SpecBegin(ASHEditRecipeViewModel)
1920

@@ -74,12 +75,25 @@
7475
expect(viewModel.shouldShowCancelButton).to.beTruthy();
7576
});
7677

77-
pending (@"returns the correct properties of steps and film type", ^{
78-
78+
it (@"returns the correct properties of steps and film type", ^{
79+
ASHEditRecipeViewModel *viewModel = [[ASHEditRecipeViewModel alloc] initWithModel:recipe];
80+
NSInteger section = 1;
81+
int32_t filmType = 1;
82+
NSInteger index = 0;
83+
84+
expect(viewModel.numberOfSteps).to.equal(recipe.steps.count);
85+
expect([viewModel filmTypeForSection:section]).to.equal(filmType);
86+
expect([viewModel sectionForFilmTpe:filmType]).to.equal(section);
87+
expect([viewModel stepTitleAtIndex:index]).to.equal([recipe.steps[index] name]);
7988
});
8089

81-
pending (@"returns a correctly instantiated edit step view model", ^{
90+
it (@"returns a correctly instantiated edit step view model", ^{
91+
ASHEditRecipeViewModel *viewModel = [[ASHEditRecipeViewModel alloc] initWithModel:recipe];
92+
NSInteger index = 0;
93+
94+
ASHEditStepViewModel *editStepViewModel = [viewModel editStepViewModelAtIndex:index];
8295

96+
expect(editStepViewModel.model).to.equal(viewModel.model.steps[index]);
8397
});
8498
});
8599

0 commit comments

Comments
 (0)