# This is a shim/monkey-path for handling engine routes in Rails 3 # http://blog.pivotal.io/labs/labs/writing-rails-engine-rspec-controller-tests module EngineControllerTestMonkeyPatch def get(action, parameters = nil, session = nil, flash = nil) process_action(action, "GET", parameters, session, flash) end # Executes a request simulating POST HTTP method and set/volley the response def post(action, parameters = nil, session = nil, flash = nil) process_action(action, "POST", parameters, session, flash) end # Executes a request simulating PUT HTTP method and set/volley the response def put(action, parameters = nil, session = nil, flash = nil) process_action(action, "PUT", parameters, session, flash) end # Executes a request simulating DELETE HTTP method and set/volley the response def delete(action, parameters = nil, session = nil, flash = nil) process_action(action, "DELETE", parameters, session, flash) end private def process_action(action, method = "GET", parameters = nil, session = nil, flash = nil) parameters ||= {} process(action, method, parameters.merge!(:use_route => :applicants), session, flash) end end