Skip to content

Expand documentation for anonymous controllers #1676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions features/controller_specs/anonymous_controller.feature
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,31 @@ Feature: anonymous controller
When I run `rspec spec`
Then the examples should all pass

Scenario: Draw custom routes for anonymous controllers which don't inherit from application controller
Given a file named "spec/controllers/other_controller_spec.rb" with:
"""ruby
require "rails_helper"
class OtherController < ActionController::Base
end

RSpec.describe OtherController, :type => :controller do
controller do
def custom
render :text => "custom called"
end
end

specify "manually draw the route to request a custom action" do
routes.draw { get "custom" => "other#custom" }

get :custom
expect(response.body).to eq "custom called"
end
end
"""
When I run `rspec spec`
Then the examples should all pass

Scenario: Draw custom routes for defined controllers
Given a file named "spec/controllers/application_controller_spec.rb" with:
"""ruby
Expand Down