Skip to content

Commit bae935c

Browse files
authored
anonymous controllers that dont inherit from ActionController::Base need special custom routes (#1676)
1 parent 3f10d49 commit bae935c

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

features/controller_specs/anonymous_controller.feature

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,31 @@ Feature: anonymous controller
470470
When I run `rspec spec`
471471
Then the examples should all pass
472472

473+
Scenario: Draw custom routes for anonymous controllers which don't inherit from application controller
474+
Given a file named "spec/controllers/other_controller_spec.rb" with:
475+
"""ruby
476+
require "rails_helper"
477+
class OtherController < ActionController::Base
478+
end
479+
480+
RSpec.describe OtherController, :type => :controller do
481+
controller do
482+
def custom
483+
render :text => "custom called"
484+
end
485+
end
486+
487+
specify "manually draw the route to request a custom action" do
488+
routes.draw { get "custom" => "other#custom" }
489+
490+
get :custom
491+
expect(response.body).to eq "custom called"
492+
end
493+
end
494+
"""
495+
When I run `rspec spec`
496+
Then the examples should all pass
497+
473498
Scenario: Draw custom routes for defined controllers
474499
Given a file named "spec/controllers/application_controller_spec.rb" with:
475500
"""ruby

0 commit comments

Comments
 (0)