spec/spec_helper.rb in flail-0.0.4 vs spec/spec_helper.rb in flail-0.0.5
- old
+ new
@@ -49,10 +49,14 @@
klass = build_controller_class do
cattr_accessor :local
define_method(:index, &action)
+ def current_user
+ @current_user
+ end
+
def local_request?
local
end
end
@@ -66,13 +70,18 @@
klass.consider_all_requests_local = options[:all_local]
klass.local = options[:local]
controller = klass.new
+
+ if options[:user]
+ controller.instance_variable_set(:@current_user, options[:user])
+ end
+
options[:request].query_parameters = options[:request].query_parameters.merge(options[:params] || {})
options[:request].session = ActionController::TestSession.new(options[:session] || {})
-
options[:request].env['REQUEST_URI'] = options[:request].request_uri
+
controller.process(options[:request], options[:response])
controller
end
def process_action_with_error(options = {})