9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/active_decorator/rspec.rb', line 9
def self.enable(example)
example.extend self
base_class = begin
ApplicationController
rescue NameError
ActionController::Base
end
controller = Class.new(base_class).new
controller.request = ActionController::TestRequest.new
if ActiveDecorator::ViewContext.respond_to?(:current=)
ActiveDecorator::ViewContext.current = controller.view_context
else
ActiveDecorator::ViewContext.push controller.view_context
end
self
end
|