File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -256,6 +256,7 @@ def namespace(space = nil, &block)
256256 alias_method :group , :namespace
257257 alias_method :resource , :namespace
258258 alias_method :resources , :namespace
259+ alias_method :segment , :namespace
259260
260261 # Create a scope without affecting the URL.
261262 #
Original file line number Diff line number Diff line change @@ -134,6 +134,19 @@ def app; subject end
134134 end
135135 subject . namespace . should == '/'
136136 end
137+
138+ it 'should accept path segments correctly' do
139+ subject . namespace :members do
140+ namespace "/:member_id" do
141+ namespace . should == '/members/:member_id'
142+ get '/' do
143+ params [ :member_id ]
144+ end
145+ end
146+ end
147+ get '/members/23'
148+ last_response . body . should == "23"
149+ end
137150
138151 it 'should be callable with nil just to push onto the stack' do
139152 subject . namespace do
@@ -143,7 +156,7 @@ def app; subject end
143156 subject . send ( :compile_path , 'hello' ) . should == '/hello(.:format)'
144157 end
145158
146- %w( group resource resources ) . each do |als |
159+ %w( group resource resources segment ) . each do |als |
147160 it "`.#{ als } ` should be an alias" do
148161 subject . send ( als , :awesome ) do
149162 namespace . should == "/awesome"
You can’t perform that action at this time.
0 commit comments