rspec-rails

https://github.com/rspec/rspec-rails

Ruby

RSpec for Rails 5+

RSpec::Rails::ViewExampleGroup::ExampleMethods#stub_template

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.

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

Source | Google | Stack overflow

Edit

git clone [email protected]:rspec/rspec-rails.git

cd rspec-rails

open lib/rspec/rails/example/view_example_group.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-RSpec--Rails--ViewExampleGroup--ExampleMethods-stub_template-for-pr


# Commit to git

git add lib/rspec/rails/example/view_example_group.rbgit commit -m "better docs for RSpec::Rails::ViewExampleGroup::ExampleMethods#stub_template"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-RSpec--Rails--ViewExampleGroup--ExampleMethods-stub_template-for-pr

hub pull-request


# Celebrate!