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

Ticket #11449 (new defect)

Opened 8 months ago

Last modified 8 months ago

Response is nil after follow_redirect! in integration test.

Reported by: ijcd Assigned to: core
Priority: normal Milestone: 2.x
Component: ActionPack Version: edge
Severity: normal Keywords: integration test follow_redirect make_resourceful
Cc: ian@ianduggan.net

Description

This happens for 2.0.2 and edge. Did not test others.

follow_redirect! is returning a response of nil rather than the expected redirect headers. Stepping through the code, it seems that last_instantiation (integration.rb) is not set properly somewhere along the way.

In the test shown here, it seems to be triggered by something that make_resourceful is doing, but I have not dug into the details there.

The attached patches demonstrate the problem, and include a fix.

All tests pass w/ the fix, and it seems reasonable, but I don't fully grok why last_instantiation would be using = instead of = in the first place.

Attachments

rails-make-resourceful-triggered-integration-test-failure.patch (1.2 kB) - added by ijcd on 03/27/08 20:27:57.
Patch against fresh rails 2.0.2 (or edge) w/ make_resourceful installed as a plugin.
rails-make-resourceful-triggered-integration-test-fix.patch (0.5 kB) - added by ijcd on 03/27/08 20:29:00.
Patch against rails 2.0.2 (works w/ edge w/ fuzz) that fixes the error.

Change History

03/27/08 20:27:57 changed by ijcd

  • attachment rails-make-resourceful-triggered-integration-test-failure.patch added.

Patch against fresh rails 2.0.2 (or edge) w/ make_resourceful installed as a plugin.

03/27/08 20:29:00 changed by ijcd

  • attachment rails-make-resourceful-triggered-integration-test-fix.patch added.

Patch against rails 2.0.2 (works w/ edge w/ fuzz) that fixes the error.

(in reply to: ↑ description ) 03/27/08 20:32:14 changed by ijcd

Wiki formatting ate my syntax. It should read:

"but I don't fully grok why last_instantiation would be using ||= instead of = in the first place"

(in reply to: ↑ description ) 03/27/08 20:43:03 changed by ijcd

A diagnosis of what in make_resourceful is causing the issue is here:

http://groups.google.com/group/make_resourceful/browse_thread/thread/588bc6f0a6d1bc65?hl=en

Relevant portion:

in integrtion.rb, the call to Controller#new is aliased to
#new_with_capture. new_with_capture stores the controller away and the
integration test later retrieve it, to check the response.

In m_r, builder, on line 85, new is called on the controller to
determine the plurality:

   available_actions = controller.new.plural? ? ACTIONS :
SINGULAR_ACTIONS

Now the integration tests store an empty controller, and
subsequentely, the integration tests fail.