I spent the better part of yesterday debugging m_r in conjunction with
integration tests. Turns out, that any controller that is m_r enabled
can't be integration testet.
After much cursing and sweating, I found out where the problem is:
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.
I hacked the following workaround:
# The available actions are defined in Default::Actions.
def actions(*available_actions)
if available_actions.first == :all
if controller.respond_to?(:new_without_capture)
available_actions = controller.new_without_capture.plural? ?
ACTIONS : SINGULAR_ACTIONS
else
available_actions = controller.new.plural? ? ACTIONS :
SINGULAR_ACTIONS
end
end
but I guess, plurality should be detemined without instantiating a new
controller.
I have but up my version of m_r on github:
http://github.com/jcfischer/make_resourceful/tree/master
cheers
Jens-Christian