Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #7124 (closed defect: fixed)

Opened 2 years ago

Last modified 1 year ago

[PATCH][tiny] Alias xhr to xml_http_request in Integration Tests

Reported by: nik.wakelin Assigned to: core
Priority: normal Milestone: 1.2.4
Component: ActionPack Version: 1.2.3
Severity: normal Keywords: integrationtests
Cc:

Description

There was no aliasing from xhr to xml_http_request in Integration Tests.

This causes you to get some weird errors if you, like me, are lazy and just type "xhr". This is because the "xhr" call is getting sent over to "test_process.rb", and not Integration::Session.

This patch adds an alias to Integration::Session and an alias to ActionController::IntegrationTest so that it proxies across.

As an aside, why do the Integration Test HTTP methods function differently from those in Functional tests? e.g

 #functional
 get(path, parameters=nil, session=nil, flash=nil)

 #integration
 get(path, parameters=nil, headers=nil)

XHR is even worse - in functional tests it takes an extra "method" parameter (i.e :post XHR or :get XHR), but not so in Integration (which just defaults to :post).

Would a patch to bring these two disparate approaches into line with each other be appreciated / used?

Attachments

alias_xhr_to_xml_http_request.diff (1.5 kB) - added by nik.wakelin on 01/17/07 11:04:33.
ticket-7124-integration-session-xhr-normalization.diff (3.3 kB) - added by francois.beausoleil on 03/27/07 15:20:22.
xml_http_request_integration.diff (8.4 kB) - added by Wizard on 05/21/07 07:41:06.

Change History

01/17/07 11:04:33 changed by nik.wakelin

  • attachment alias_xhr_to_xml_http_request.diff added.

(follow-up: ↓ 2 ) 01/28/07 16:46:11 changed by bitsweat

  • status changed from new to closed.
  • resolution set to wontfix.

Indeed - I'd rather see the confusion cleaned up entirely. It's really confusing how integration tests sometimes call functional test methods.

(in reply to: ↑ 1 ) 01/28/07 20:21:24 changed by nik.wakelin

Replying to bitsweat:

Indeed - I'd rather see the confusion cleaned up entirely. It's really confusing how integration tests sometimes call functional test methods.

No problems - I'll put together something that makes get, post, and xml_http_request calls universal - i.e method_name(path, params, session, flash). Do I make a new ticket for that, or attach it to this one?

01/28/07 22:31:24 changed by bitsweat

Please update and reopen this ticket when you attach the new patch. Thanks!

03/27/07 15:20:22 changed by francois.beausoleil

  • attachment ticket-7124-integration-session-xhr-normalization.diff added.

03/27/07 15:22:03 changed by francois.beausoleil

  • status changed from closed to reopened.
  • version changed from edge to 1.2.3.
  • resolution deleted.
  • milestone changed from 1.x to 1.2.4.

I just attached a patch to resolve this issue. The patch was made against the 1.2 stable branch, but applies cleanly after switching to trunk@6472.

05/20/07 19:29:50 changed by Wizard

Updated patch, using rev.6790 (bump!)

05/20/07 23:17:51 changed by bitsweat

Missing the deprecation warning.

05/21/07 07:41:06 changed by Wizard

  • attachment xml_http_request_integration.diff added.

05/21/07 07:47:43 changed by Wizard

I've updated the patch.

05/21/07 09:15:20 changed by bitsweat

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [6796]) Integration tests: alias xhr to xml_http_request and add a request_method argument instead of always using POST. Closes #7124.

05/21/07 09:19:55 changed by bitsweat

(In [6797]) Merge [6796] to stable from trunk. Integration tests: alias xhr to xml_http_request and add a request_method argument instead of always using POST. References #7124.