Skip to content

Commit ee3f224

Browse files
committed
Merge branch 'controller-draw-docs'
2 parents 04ec29e + 4469230 commit ee3f224

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Enhancements
77
* Rails 4 support for `ActiveRecord::Relation` and the `=~` operator matcher.
88
(Andy Lindeman)
99
* `be_valid` matcher includes validation error messages. (Tom Scott)
10+
* Adds cucumber scenario showing how to invoke an anonymous controller's
11+
non-resourceful actions. (Paulo Luis Franchini Casaretto)
1012

1113
Bug fixes
1214

features/controller_specs/anonymous_controller.feature

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,26 @@ Feature: anonymous controller
328328
"""
329329
When I run `rspec spec`
330330
Then the examples should all pass
331+
332+
Scenario: draw custom routes for anonymous controllers
333+
Given a file named "spec/controllers/application_controller_spec.rb" with:
334+
"""ruby
335+
require "spec_helper"
336+
337+
describe ApplicationController do
338+
controller do
339+
def custom
340+
render :text => "custom called"
341+
end
342+
end
343+
344+
specify "a custom action can be requested if routes are drawn manually" do
345+
routes.draw { get "custom" => "anonymous#custom" }
346+
347+
get :custom
348+
expect(response.body).to eq "custom called"
349+
end
350+
end
351+
"""
352+
When I run `rspec spec`
353+
Then the examples should all pass

0 commit comments

Comments
 (0)