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

Fixes #629 #640

Merged
merged 1 commit into from
Oct 30, 2018
Merged

Fixes #629 #640

merged 1 commit into from
Oct 30, 2018

Conversation

Marri
Copy link
Contributor

@Marri Marri commented Oct 20, 2018

The FunctionalTestRecording module's version of process() was not being called when running tests, which meant @collector was never initialized and so examples were not written to the file.
To fix this, we need to prepend FunctionalTestRecording to ActionController::TestCase::Behavior, not ActionController::TestCase, for reasons which I honestly did not manage to determine. (You can follow some of my debug rambling in the original issue.)

I'm not actually clear if this fix is safe to merge as is; presumably the original version is there for a reason, I'd've expected the prepend() to apply to the subclass as well as the parent, and this may be more version-specific than I'm giving it credit for. My testing was all done against APIPie 0.5.13 and Rails 5.1.6 and Ruby 2.5.1 and RSpec 3.7.2. The full codebase is available at https://github.com/Marri/glowfic.

@Marri
Copy link
Contributor Author

Marri commented Oct 20, 2018

Hmmm, that one failing build seems to be failing on other PRs as well - if I have time I'll take a look at it as well, but since it's happening on other PRs, and also it's a Rails 4.2 build and my changes are all behind a 5.0 check, I'm pretty confident it's unrelated to this change.

@@ -22,7 +22,7 @@ class Apipie::Railtie
prepend Apipie::Extractor::Recorder::FunctionalTestRecording
end
else
ActionController::TestCase.send(:prepend, Apipie::Extractor::Recorder::FunctionalTestRecording)
ActionController::TestCase::Behavior.send(:prepend, Apipie::Extractor::Recorder::FunctionalTestRecording)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new version is not working for me. So I guess the original line was there for a reason, Why not to keep both lines in, so that it works for everyone?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How sensible! :) Fix made and pushed.

The FunctionalTestRecording module's version of process() was not being called when running tests, which meant @collector was never initialized and so examples were not written to the file.
To fix this, we need to prepend FunctionalTestRecording to ActionController::TestCase::Behavior, not ActionController::TestCase, for reasons which I honestly did not manage to determine.
@iNecas
Copy link
Member

iNecas commented Oct 30, 2018

Test failure unrelated. Thanks @Marri

@iNecas iNecas merged commit 665c54b into Apipie:master Oct 30, 2018
@iNecas
Copy link
Member

iNecas commented Nov 16, 2018

apipie-rails-0.5.14 has just been released, including this fix

@Marri
Copy link
Contributor Author

Marri commented Nov 26, 2018

Thank you!

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.

2 participants