Create a gist now

Instantly share code, notes, and snippets.

@alloy /gist:4564152
Last active Dec 11, 2015

What would you like to do?

Expectations: Count changes

  • [[theBlock(^{ ... }) should] change:^{ return (NSInteger)count; }]
  • [[theBlock(^{ ... }) should] change:^{ return (NSInteger)count; } by:+1]
  • [[theBlock(^{ ... }) should] change:^{ return (NSInteger)count; } by:-1]

Example:

	[[theBlock(^{
	    [array addObject:@"foo"];
	}) should] change:^{ return (NSInteger)[array count]; } by:+1];
  
	[[theBlock(^{
	    [array addObject:@"bar"];
	    [array removeObject:@"foo"];
	}) shouldNot] change:^{ return (NSInteger)[array count]; }];

	[[theBlock(^{
	    [array removeObject:@"bar"];
	}) should] change:^{ return (NSInteger)[array count]; } by:-1];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment