1
0
Fork 0
mirror of https://github.com/drapergem/draper synced 2023-03-27 23:21:17 -04:00

provide a standard method for establishing a view context in testing situations

This commit is contained in:
Ryan Cook 2012-05-17 23:53:42 -06:00
parent 4c090ba2a6
commit b46bb990f1

View file

@ -0,0 +1,12 @@
module Draper
module ViewContext
def self.infect!(context)
context.instance_eval do
ApplicationController.new.set_current_view_context
Draper::ViewContext.current.controller.request ||= ActionController::TestRequest.new
Draper::ViewContext.current.request ||= Draper::ViewContext.current.controller.request
Draper::ViewContext.current.params ||= {}
end
end
end
end