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 issue with process method not visible in integration tests #14071

Closed

Conversation

mauricio
Copy link
Contributor

Since process was private in ActionDispatch::Integration::RequestHelpers::Session, when you call process inside an integration test it would never call process at the current session as Ruby 2.0 and onwards only checks for public methods and process being private is always a false result when method_missing gets called inside ActionDispatch::Integration::RequestHelpers::Runner.

Making it public allows it to be called again inside integration tests and fixes rspec/rspec-rails#925.

@monfresh
Copy link

Any updates on this PR? It would be great to have this fix so we can test the OPTIONS verb in RSpec tests. In the meantime, if anyone knows of a workaround, it would be greatly appreciated. Thanks!

@mauricio
Copy link
Contributor Author

Still waiting for feedback so far, no one from the Rails team has looked at it, it seems.

@rafaelfranca
Copy link
Member

Could you rebase it?

Since process was private in ActionDispatch::Integration::RequestHelpers::Session,
when you call process inside an integration test it would never
call process on it as Ruby 2.0 and onwards only checks for public
methods. Making it public allows it to be called again inside
integration tests and fixes rspec/rspec-rails#925.
@mauricio mauricio force-pushed the fix-process-on-integration-tests branch from 89a59ee to 316db75 Compare February 26, 2015 00:11
@mauricio
Copy link
Contributor Author

@rafaelfranca rebased now.

@jeremysears
Copy link

I'm running into this too. I'd like to test OPTIONS HTTP Method for CORS preflight requests.

@monfresh
Copy link

@jeremysears If you're using RSpec, you can test it with this workaround:

This helper method: https://github.com/codeforamerica/ohana-api/blob/master/spec/support/request_helpers.rb#L9-L16

and specs that look like this: https://github.com/codeforamerica/ohana-api/blob/master/spec/api/cors_spec.rb

@rails-bot
Copy link

rails-bot bot commented Dec 18, 2019

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Thank you for your contributions.

@rails-bot rails-bot bot unassigned sgrif Dec 18, 2019
@rails-bot rails-bot bot added the stale label Dec 18, 2019
@rails-bot rails-bot bot closed this Dec 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to test OPTIONS requests in Rails integration tests
5 participants