Skip to content

Commit afb7bc8

Browse files
committed
Workaround for #292.
1 parent 0caf339 commit afb7bc8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Source/OCMock/OCClassMockObject.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ - (void)addStub:(OCMInvocationStub *)aStub
8989

9090
- (void)prepareClassForClassMethodMocking
9191
{
92-
/* haven't figured out how to work around runtime dependencies on NSString, so exclude it for now */
93-
if([[mockedClass class] isSubclassOfClass:[NSString class]])
92+
/* the runtime and OCMock depend on string and array; we don't intercept methods on them to avoid endless loops */
93+
if([[mockedClass class] isSubclassOfClass:[NSString class]] || [[mockedClass class] isSubclassOfClass:[NSArray class]])
9494
return;
9595

9696
/* if there is another mock for this exact class, stop it */

Source/OCMockTests/OCMockObjectRuntimeTests.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ - (void)testCanStubValueForKeyMethod
118118
}
119119

120120

121+
- (void)testCanMockNSMutableArray
122+
{
123+
id mock = [OCMockObject niceMockForClass:[NSMutableArray class]];
124+
id anArray = [[NSMutableArray alloc] init];
125+
}
126+
127+
121128
- (void)testForwardsIsKindOfClass
122129
{
123130
id mock = [OCMockObject mockForClass:[NSString class]];

0 commit comments

Comments
 (0)