Skip to content

Instantly share code, notes, and snippets.

@alloy
Last active December 11, 2015 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alloy/4564152 to your computer and use it in GitHub Desktop.
Save alloy/4564152 to your computer and use it in GitHub Desktop.

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