Added a helper to make OPTIONS calls in controller tests #1277

Closed
wants to merge 1 commit into from

6 participants

@kaiwren

I just saw a request by someone on the rspec-users mailing list for support for the OPTIONS http verb in controller specs. See http://rubyforge.org/pipermail/rspec-users/2011-May/020082.html

It makes sense to me that this exist in Rails (as opposed to rspec-rails) since OPTIONS is one of the better ways to figure out what resources do when building RESTful APIs.

I couldn't find where I should write the tests - if you could point me at the file where they're written, I'd be happy to add them.

@jake3030 jake3030 pushed a commit to jake3030/rails that referenced this pull request Jun 28, 2011
@atnan atnan Ensure that when UrlWriter is included in multiple classes, the defau…
…lt_url_options of one don't affect the other. [#1277 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
32eeb3e
@sikachu
Ruby on Rails member

Referring to the nearest method - xml_http_request, I think you better write your test in actionpack/test/controller/integration_test.rb. Please add test, amend your commit, and force-push to your branch.

@kaiwren

Since there was a bit more than adding the tests (integration_test.rb covered a few other scenarios) I've added new commits. Please feel free to squash as you see fit.

Thank you.

@sikachu
Ruby on Rails member

Do you mind squashed them and rebased your branch against current master ?

@achamian

@sikachu I have rebased and squashed the commit.

@tjouan

Any chance for this to be merged?

If additionnal work is needed, I may be able to help.

@achamian

@tjouan I have rebased changes on master again

@inferiorhumanorgans

BTW, it'd be nice to see support for other HTTP (ex: DAV's PROPFIND, PROPPATCH, REPORT, etc) verbs included.

@pixeltrix
Ruby on Rails member

Rather than adding support for a multitude of HTTP request methods I think it makes more sense to make process a public method in integration.rb and leave it at that. It's not too much to ask that tests use process :options, '/path'.

@pixeltrix pixeltrix closed this Apr 29, 2012
@pixeltrix
Ruby on Rails member

Just for the record OPTIONS support was added in ad46884

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment