Created
October 31, 2012 07:58
-
-
Save fgarcia/3985726 to your computer and use it in GitHub Desktop.
test notification posting with #ocmock
This file contains hidden or 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
| - (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