rspec-rails
https://github.com/rspec/rspec-rails
Ruby
RSpec for Rails 5+
RSpec::Rails::ViewExampleGroup::ExampleMethods#view
The instance of `ActionView::Base` that is used to render the template.
Use this to stub methods _before_ calling `render`.
describe "widgets/new.html.erb" do
it "shows all the widgets" do
view.stub(:foo) { "foo" }
render
# ...
end
endEdit
git clone [email protected]:rspec/rspec-rails.git
cd rspec-rails
open lib/rspec/rails/example/view_example_group.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-RSpec--Rails--ViewExampleGroup--ExampleMethods-view-for-pr
# Commit to gitgit add lib/rspec/rails/example/view_example_group.rbgit commit -m "better docs for RSpec::Rails::ViewExampleGroup::ExampleMethods#view"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-RSpec--Rails--ViewExampleGroup--ExampleMethods-view-for-pr
hub pull-request
# Celebrate!