Sha256: 801e2b3673d86355e9bbe64690d95a887a6dd2255bb44bae28204da24abe0c6d

Contents?: true

Size: 954 Bytes

Versions: 8

Compression:

Stored size: 954 Bytes

Contents

#import "EXPMatchers+beSubclassOf.h"
#import "NSValue+Expecta.h"
#import <objc/runtime.h>

EXPMatcherImplementationBegin(beSubclassOf, (Class expected)) {
  __block BOOL actualIsClass = YES;

  prerequisite(^BOOL {
    actualIsClass = class_isMetaClass(object_getClass(actual));
    return actualIsClass;
  });

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

  failureMessageForTo(^NSString *{
    if(!actualIsClass) return @"the actual value is not a Class";
    return [NSString stringWithFormat:@"expected: a subclass of %@, got: a class %@, which is not a subclass of %@", [expected class], actual, [expected class]];
  });

  failureMessageForNotTo(^NSString *{
    if(!actualIsClass) return @"the actual value is not a Class";
    return [NSString stringWithFormat:@"expected: not a subclass of %@, got: a class %@, which is a subclass of %@", [expected class], actual, [expected class]];
  });
}
EXPMatcherImplementationEnd

Version data entries

8 entries across 8 versions & 2 rubygems

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