module RSpec::Rails::ViewExampleGroup::InstanceMethods
def _controller_path
def _controller_path _path_parts[0..-2].join("/") end
def _default_file_to_render
def _default_file_to_render example.example_group.top_level_description end
def _include_controller_helpers
def _include_controller_helpers helpers = controller._helpers view.singleton_class.class_eval do include helpers unless included_modules.include?(helpers) end end
def _inferred_action
def _inferred_action _path_parts.last.split(".").first end
def _path_parts
def _path_parts _default_file_to_render.split("/") end
def params
view:
Provides access to the params hash that will be available within the
def params controller.params end
def render(options={}, local_assigns={}, &block)
end
...
render # => view.render(:file => "widgets/new.html.erb")
it "shows all the widgets" do
describe "widgets/new.html.erb" do
will pass the top level description to render:
The only addition is that you can call render with no arguments, and RSpec
info.
Delegates to ActionView::Base#render, so see documentation on that for more
render({:partial => "widgets/widget.html.erb"}, {... locals ...}) do ... end
render({:partial => "widgets/widget.html.erb"}, {... locals ...})
render(:template => "widgets/new.html.erb")
render
:call-seq:
def render(options={}, local_assigns={}, &block) options = {:template => _default_file_to_render} if Hash === options and options.empty? super(options, local_assigns, &block) end
def response
def response RSpec.deprecate("response", "rendered") rendered end
def template
def template RSpec.deprecate("template","view") view end
def view
end
...
render
view.stub(:foo) { "foo" }
it "shows all the widgets" do
describe "widgets/new.html.erb" do
on the view:
Use this before the +render+ call to stub any methods you want to stub
The instance of ActionView::Base that is used to render the template.
def view _view end