Skip to content

Instantly share code, notes, and snippets.

@andrespch
Last active March 13, 2020 16:35
Show Gist options
  • Save andrespch/da3c0fe57e3b9dcfde63657f3e7f2085 to your computer and use it in GitHub Desktop.
Save andrespch/da3c0fe57e3b9dcfde63657f3e7f2085 to your computer and use it in GitHub Desktop.
#import <XCTest/XCTest.h>
#import "User.h"
@interface UserTests : XCTestCase
@end
@implementation UserTests {
User *subject;
}
- (void)setUp
{
[super setUp];
subject = [[User alloc] init];
}
- (void)tearDown
{
subject = nil;
[super tearDown];
}
- (void)setupEmailConfirmed:(BOOL)confirmed
{
subject.hasConfirmedEmail = confirmed;
}
- (void)test_canSubscribeToNewsletter_whenEmailConfirmed_isTrue
{
[self setupEmailConfirmed:YES];
NSAssertTrue(subject.canSubscribeToNewsletter);
}
- (void)test_canSubscribeToNewsletter_whenEmailNotConfirmed_isFalse
{
[self setupEmailConfirmed:NO];
NSAssertFalse(subject.canSubscribeToNewsletter);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment