petejkim/expecta — pull request #15 by lukeredpath (2012-03-26 22:09:32+00:00)
Title: Dynamic predicate matchers

(sorry, this also includes the commits of my other pull request - not sure how to work around that).

The newest commits on this pull request add support for dynamic predicate matchers. You still need to define the matcher interfaces to satisfy the compiler but you don't need the corresponding matcher implementation as it will be handled at runtime.

Example from the test case:

```objc
@interface LightSwitch : NSObject
@property (nonatomic, assign, getter=isTurnedOn) BOOL turnedOn;
@end

@implementation LightSwitch
@synthesize turnedOn;
@end

EXPMatcherInterface(isTurnedOn, (void));
#define beTurnedOn isTurnedOn

@interface DynamicPredicateMatcherTest : SenTestCase
@end

@implementation DynamicPredicateMatcherTest

- (void)test_CanUseObjectPredicatesAsBooleanMatchers
{
LightSwitch *lightSwitch = [[LightSwitch alloc] init];

lightSwitch.turnedOn = YES;

expect(lightSwitch).to.beTurnedOn();

lightSwitch.turnedOn = NO;

expect(lightSwitch).toNot.beTurnedOn();
}

@end
```