Closed davidsansome closed 6 years ago
Hey. So I had an issue and noticed this as well. When will this PR get into a new version on cocoapods ?
I had planned to wait for the outcome of #339 to include in the next minor release. It's been taken a while, I know.
This PR created a regression, If 2 partial mocks are created with the same underlying Class type, then the first mock stops forwarding @selectors to the real object.
p1.name = @"Person 1";
p2.name = @"Person 2";
Person *mock1 = OCMPartialMock(p1);
mock1.name == @"Person 1"
Person *mock2 = OCMPartialMock(p2);
mock2.name == @"Person 2"
mock1.name == nil //😱
Could you check whether the fix I just committed works for you? The new tests introduced in this PR still pass, but the class pair is disposed a little later; not when the second mock takes over but when stopMocking
is called on the first mock.
Previously that first dynamically created subclass was kept around forever, and if accessed somehow (for example by enumerating objc_getClassList) would always raise NSInternalInconsistencyException.