Sha256: abc0aa9fbc48079953efef18a8269eec0ef47c688a8958dd62752f4a662b0fa6

Contents?: true

Size: 961 Bytes

Versions: 8

Compression:

Stored size: 961 Bytes

Contents

#import "EXPMatchers+respondTo.h"
#import "EXPMatcherHelpers.h"

EXPMatcherImplementationBegin(respondTo, (SEL expected)) {
  BOOL actualIsNil = (actual == nil);
  BOOL expectedIsNull = (expected == NULL);

  prerequisite (^BOOL {
    return !(actualIsNil || expectedIsNull);
  });

  match(^BOOL {
    return [actual respondsToSelector:expected];
  });

  failureMessageForTo(^NSString *{
    if (actualIsNil) return @"the object is nil/null";
    if (expectedIsNull) return @"the selector is null";
    return [NSString stringWithFormat:@"expected: %@ to respond to %@", EXPDescribeObject(actual), NSStringFromSelector(expected)];
  });

  failureMessageForNotTo(^NSString *{
    if (actualIsNil) return @"the object is nil/null";
    if (expectedIsNull) return @"the selector is null";
    return [NSString stringWithFormat:@"expected: %@ not to respond to %@", EXPDescribeObject(actual), NSStringFromSelector(expected)];
  });
}
EXPMatcherImplementationEnd

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
second_curtain-0.6.0 Demo/Pods/Expecta/src/matchers/EXPMatchers+respondTo.m
second_curtain-0.5.0 Demo/Pods/Expecta/src/matchers/EXPMatchers+respondTo.m
second_curtain-0.4.0 Demo/Pods/Expecta/src/matchers/EXPMatchers+respondTo.m
second_curtain-0.3.0 Demo/Pods/Expecta/src/matchers/EXPMatchers+respondTo.m
cocoapods-deintegrate-0.2.1 spec/fixtures/Project/StaticLibraries/Pods/Expecta/src/matchers/EXPMatchers+respondTo.m
cocoapods-deintegrate-0.2.0 spec/fixtures/Project/StaticLibraries/Pods/Expecta/src/matchers/EXPMatchers+respondTo.m
second_curtain-0.2.4 Demo/Pods/Expecta/src/matchers/EXPMatchers+respondTo.m
second_curtain-0.2.3 Demo/Pods/Expecta/src/matchers/EXPMatchers+respondTo.m