rspec-rails

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

Ruby

RSpec for Rails 5+

RSpec::Rails::ControllerExampleGroup::ClassMethods#controller

Supports a simple DSL for specifying behavior of ApplicationController.
Creates an anonymous subclass of ApplicationController and evals the
`body` in that context. Also sets up implicit routes for this
controller, that are separate from those defined in "config/routes.rb".

If you would like to spec a subclass of ApplicationController, call
controller like so:

    controller(ApplicationControllerSubclass) do
      # ....
    end

Source | Google | Stack overflow

Edit

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

cd rspec-rails

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

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-RSpec--Rails--ControllerExampleGroup--ClassMethods-controller-for-pr


# Commit to git

git add lib/rspec/rails/example/controller_example_group.rbgit commit -m "better docs for RSpec::Rails::ControllerExampleGroup::ClassMethods#controller"


# 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--ControllerExampleGroup--ClassMethods-controller-for-pr

hub pull-request


# Celebrate!