Created
August 2, 2013 20:42
-
-
Save gfontenot/6143314 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SpecBegin(TTUser) | |
describe(@"TTUser", ^{ | |
__block TTUser *user; | |
__block NSDictionary *userDict; | |
before(^{ | |
userDict = @{ @"name" : @"Hormell Ansley", @"email" : @"[email protected]", @"id" : @1 }; | |
}); | |
sharedExamplesFor(@"creating a user", ^(NSDictionary *dict){ | |
beforeAll(^{ | |
user = dict[@"user"]; | |
}); | |
it(@"creates a user object", ^{ | |
expect(user).toNot.beNil; | |
}); | |
it(@"sets the user's email", ^{ | |
expect(user.email).to.equal(@"[email protected]"); | |
}); | |
it(@"sets the user's name", ^{ | |
expect(user.name).to.equal(@"Horell Ansley"); // should fail, does not | |
}); | |
}); | |
describe(@"-initWithDictionary:", ^{ | |
itShouldBehaveLike(@"creating a user", ^{ | |
return @{ @"user" : [[TTUser alloc] initWithDictionary:userDict] }; | |
}); | |
}); | |
describe(@"+userWithJSON:", ^{ | |
itShouldBehaveLike(@"creating a user", ^{ | |
return @{ @"user" : [TTUser userWithJSON:userDict] }; | |
}); | |
}); | |
}); | |
SpecEnd |
petejkim
commented
Aug 2, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment