Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Commit

Permalink
Change NSObjectSpec+MethodRedirection.mm to run determininstically
Browse files Browse the repository at this point in the history
  • Loading branch information
wiley committed Aug 24, 2015
1 parent 774b3bb commit ece35f7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Foundation/Spec/Extensions/NSObjectSpec+MethodRedirection.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ @interface Redirectable (redirected_methods)

+ (int)embiggen_original:(int)number;
- (NSString *)cheekify_original:(NSString *)string;
- (NSString *)cheekify_other:(NSString *)string;

@end

Expand Down Expand Up @@ -64,13 +65,15 @@ - (NSString *)stodgify:(NSString *)string
[Redirectable redirectSelector:@selector(cheekify:) to:@selector(cheekify_new:) andRenameItTo:@selector(cheekify_original:)];

[redirectable cheekify:@"Herman"] should equal(@"No, really, Herman is so cheeky");

[Redirectable redirectSelector:@selector(cheekify:) to:@selector(cheekify_original:) andRenameItTo:@selector(cheekify_other:)];
});

it(@"should do nothing when the new selector name (i.e. the argumen to andRenameItTo:) already exists", ^{
[Redirectable redirectSelector:@selector(cheekify:) to:@selector(cheekify_new:) andRenameItTo:@selector(stodgify:)];

[redirectable stodgify:@"Herman"] should equal(@"Herman is so stodgy");
[redirectable cheekify:@"Herman"] should equal(@"No, really, Herman is so cheeky");
[redirectable cheekify:@"Herman"] should equal(@"Herman is so cheeky");
});
});

Expand Down

0 comments on commit ece35f7

Please sign in to comment.