Skip to content

Instantly share code, notes, and snippets.

@fgarcia
Created October 31, 2012 07:58
Show Gist options
  • Save fgarcia/3985726 to your computer and use it in GitHub Desktop.
Save fgarcia/3985726 to your computer and use it in GitHub Desktop.
test notification posting with #ocmock
- (void)testNotificationWhenEditingNonTodayStat
{
// given
id mock = [OCMockObject observerMock];
[[NSNotificationCenter defaultCenter] addMockObserver:mock name:FGNPastStatWasUpgraded object:nil];
[[mock expect] notificationWithName:FGNPastStatWasUpgraded object:nil];
_this.date = [DLCommon dateFromString:@"2010-04-01"];
// when
_this.reviewedValue++;
// then
[mock verify];
[[NSNotificationCenter defaultCenter] removeObserver:mock];
}
- (void)testNotificationNotSentWhenEditingTodayStats
{
// given
id mock = [OCMockObject observerMock];
[[NSNotificationCenter defaultCenter] addMockObserver:mock name:FGNPastStatWasUpgraded object:nil];
_this.date = TODAY;
// when
_this.reviewedValue++;
// then
[mock verify];
[[NSNotificationCenter defaultCenter] removeObserver:mock];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment