class Spec::Rails::Example::ViewExampleGroup
def render(*args)
render(:inline => "<% custom_helper 'argument', 'another argument' %>")
render(:partial => '/people/_address')
render('/people/list', :helpers => [MyHelper, MyOtherHelper])
render('/people/list', :helper => MyHelper)
render('/people/list')
== Examples
use to spec custom form builders, helpers, etc, in the context of a view.
through the +response+. Also supports render with :inline, which you can
Renders a template for a View Spec, which then provides access to the result
def render(*args) options = Hash === args.last ? args.pop : {} if args.empty? unless [:partial, :inline, :file, :template, :xml, :json, :update].any? {|k| options.has_key? k} args << self.class.description_parts.first end end options[:template] = args.first.to_s.sub(/^\//,'') unless args.empty? set_base_view_path(options) add_helpers(options) assigns[:action_name] = @action_name @request.path_parameters = @request.path_parameters.merge( :controller => derived_controller_name(options), :action => derived_action_name(options) ).merge(options[:path_parameters] || {}) defaults = { :layout => false } options = defaults.merge options @controller.__send__(:params).reverse_merge! @request.parameters @controller.class.instance_eval %{ def controller_path "#{derived_controller_name(options)}" end def controller_name "#{derived_controller_name(options).split('/').last}" end } @controller.__send__ :forget_variables_added_to_assigns @controller.__send__ :render, options @controller.__send__ :process_cleanup end