Module RSpec::Rails::ViewExampleGroup::InstanceMethods
In: lib/rspec/rails/example/view_example_group.rb

Methods

params   render   response   stub_template   template   view  

Public Instance methods

Provides access to the params hash that will be available within the view:

      params[:foo] = 'bar'

Delegates to ActionView::Base#render, so see documentation on that for more info.

The only addition is that you can call render with no arguments, and RSpec will pass the top level description to render:

  describe "widgets/new.html.erb" do
    it "shows all the widgets" do
      render # => view.render(:file => "widgets/new.html.erb")
      ...
    end
  end

Deprecated. Use rendered instead.

Simulates the presence of a template on the file system by adding a Rails’ FixtureResolver to the front of the view_paths list. Designed to help isolate view examples from partials rendered by the view template that is the subject of the example.

Example

  stub_template("widgets/_widget.html.erb" => "This content.")

Deprecated. Use view instead.

The instance of ActionView::Base that is used to render the template. Use this before the render call to stub any methods you want to stub on the view:

  describe "widgets/new.html.erb" do
    it "shows all the widgets" do
      view.stub(:foo) { "foo" }
      render
      ...
    end
  end

[Validate]