class Deas::TestRunner
Constants
- ContentTypeArgs
- RenderArgs
- SendFileArgs
Attributes
content_type_args[R]
Public Class Methods
new(handler_class, args = nil)
click to toggle source
Calls superclass method
Deas::Runner::new
# File lib/deas/test_runner.rb, line 14 def initialize(handler_class, args = nil) if !handler_class.include?(Deas::ViewHandler) raise InvalidViewHandlerError, "#{handler_class.inspect} is not a " \ "Deas::ViewHandler" end @run_return_value = nil @content_type_args = nil @halted = false a = (args || {}).dup super(handler_class, { :logger => a.delete(:logger), :router => a.delete(:router), :template_source => a.delete(:template_source), :request => a.delete(:request), :route_path => a.delete(:route_path), :params => NormalizedParams.new(a.delete(:params) || {}).value }) @splat = a.delete(:splat) a.each{|key, value| self.handler.send("#{key}=", value) } catch(:halt){ self.handler.deas_init } end
Public Instance Methods
content_type(extname, params = nil)
click to toggle source
helpers
Calls superclass method
Deas::Runner#content_type
# File lib/deas/test_runner.rb, line 49 def content_type(extname, params = nil) @content_type_args = ContentTypeArgs.new(extname, params) super end
halt(*args)
click to toggle source
Calls superclass method
Deas::Runner#halt
# File lib/deas/test_runner.rb, line 54 def halt(*args) @halted = true @run_return_value ||= HaltArgs.new(args) super end
halted?()
click to toggle source
# File lib/deas/test_runner.rb, line 40 def halted?; @halted; end
redirect(location, *halt_args)
click to toggle source
Calls superclass method
Deas::Runner#redirect
# File lib/deas/test_runner.rb, line 60 def redirect(location, *halt_args) @run_return_value ||= RedirectArgs.new(location, HaltArgs.new(halt_args)) super end
run()
click to toggle source
# File lib/deas/test_runner.rb, line 42 def run catch(:halt){ self.handler.deas_run } if !self.halted? @run_return_value end
send_file(file_path, opts = nil)
click to toggle source
Calls superclass method
Deas::Runner#send_file
# File lib/deas/test_runner.rb, line 65 def send_file(file_path, opts = nil) @run_return_value ||= SendFileArgs.new(file_path, opts) super end
source_partial(source, template_name, locals = nil)
click to toggle source
Calls superclass method
Deas::Runner#source_partial
# File lib/deas/test_runner.rb, line 75 def source_partial(source, template_name, locals = nil) # partials don't interact with the response body so they shouldn't affect # the run return value (like renders do). Render the markup and discard # it to test the template. Return the render args so you can test the # expected partials were rendered. super RenderArgs.new(source, template_name, locals) end
source_render(source, template_name, locals = nil)
click to toggle source
Calls superclass method
Deas::Runner#source_render
# File lib/deas/test_runner.rb, line 70 def source_render(source, template_name, locals = nil) @run_return_value ||= RenderArgs.new(source, template_name, locals) super end
splat()
click to toggle source
# File lib/deas/test_runner.rb, line 39 def splat; @splat; end