Created
May 5, 2013 02:11
-
-
Save mmertsock/5519408 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface TestClass1 : NSObject | |
+ (NSString *)getSomeString; | |
- (NSString *)doSomething; | |
- (NSString *)doSomethingElse; | |
@end | |
@interface TestClass1 (TestClass1Catgegory) | |
+ (NSString *)ext_getSomeString:(NSString *)input; | |
@end | |
@implementation TestClass1 | |
+ (NSString *)getSomeString | |
{ | |
return @"getSomeStringResult"; | |
} | |
- (NSString *)doSomething | |
{ | |
return [TestClass1 getSomeString]; | |
} | |
- (NSString *)doSomethingElse | |
{ | |
return [TestClass1 ext_getSomeString:@"ext"]; | |
} | |
@end | |
@implementation TestClass1 (TestClass1Catgegory) | |
+ (NSString *)ext_getSomeString:(NSString *)input | |
{ | |
return [input stringByAppendingString:@"-got"]; | |
} | |
@end | |
SPEC_BEGIN(ShouldReceiveSpec) | |
describe(@"Attempt to repor 'MagicalRecord MR_createInContext: returns nil'", ^{ | |
it(@"should not return nil when using shouldReceive on a class method", ^{ | |
TestClass1 *object = [TestClass1 new]; | |
[[[TestClass1 class] should] receive:@selector(getSomeString)]; | |
NSString *result = [object doSomething]; | |
[[result should] equal:@"getSomeStringResult"]; | |
}); | |
it(@"should not return nil when using shouldReceive on a class method defined in a category", ^{ | |
TestClass1 *object = [TestClass1 new]; | |
[[[TestClass1 class] should] receive:@selector(ext_getSomeString:)]; | |
NSString *result = [object doSomethingElse]; | |
[[result should] equal:@"ext-got"]; | |
}); | |
}); | |
SPEC_END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment