Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression in Mock#responds_like behaviour #583

Closed
wants to merge 2 commits into from

Conversation

floehopper
Copy link
Member

The regression was inadvertently introduced in this commit and indirectly led to this issue.

I've attempted to thoroughly characterise the pre-regression behaviour of Mock#responds_like in a new acceptance test, RespondsLikeTest, in order to reduce the chances of any such regressions occurring in the future. I've also added another acceptance test, ArrayFlattenTest, which reproduced the issue until the regression was fixed.

Investigating this has made me realise that the behaviour of Mock#responds_like in combination with protected & private methods on the responder was not specified in the documentation. I've attempted to reverse engineer the documentation so that it more fully describes the pre-regression behaviour.

Note that the CI build for Ruby v1.9 is using an old version of Minitest which doesn't work with the RespondsLikeTest and since support for Ruby v1.9 was dropped in Mocha v2, I don't think it's worth the effort to sort this out so I've just disabled the test for Ruby v1.9.

The regression was inadvertently introduced in this commit [1] and
indirectly led to this issue [2].

I've attempted to thoroughly characterise the pre-regression behaviour
of Mock#responds_like in a new acceptance test, RespondsLikeTest, in
order to reduce the chances of any such regressions occurring in the
future. I've also added another acceptance test, ArrayFlattenTest, which
reproduced the issue in [2] until the regression was fixed.

Investigating this has made me realise that the behaviour of
Mock#responds_like in combination with protected & private methods on
the responder was not specified in the documentation. I've attempted to
reverse engineer the documentation so that it more fully describes the
pre-regression behaviour.

Note that the CI build for Ruby v1.9 is using an old version of Minitest
which doesn't work with the RespondsLikeTest and since support for Ruby
v1.9 was dropped in Mocha v2, I don't think it's worth the effort to
sort this out so I've just disabled the test for Ruby v1.9.

[1]: 365a734
[2]: #580
@floehopper
Copy link
Member Author

floehopper commented Nov 4, 2022

This is a first stab at fixing the issue highlighted in #580. However, there are still some things to resolve:

/cc @chrisroos

@floehopper floehopper marked this pull request as ready for review November 7, 2022 15:18
@floehopper
Copy link
Member Author

This fix has been released in v1.15.1, v1.16.1 & v2.0.2. Closing.

@floehopper floehopper closed this Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant