-
Notifications
You must be signed in to change notification settings - Fork 508
/
test_restful_routing.rb
33 lines (29 loc) · 1.05 KB
/
test_restful_routing.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require File.expand_path(File.dirname(__FILE__) + '/helper')
describe "Routing" do
it 'should perform restul routing' do
mock_app do
controller :parent => :parents do
get :index, :with => :asset_id do
"#{url_for(:index, params[:parent_id], :asset_id => params[:asset_id])} get"
end
put :index, :with => :asset_id do
"#{url_for(:index, params[:parent_id], :asset_id => params[:asset_id])} put"
end
post :index, :with => :asset_id do
"#{url_for(:index, :parent_id => params[:parent_id], :asset_id => params[:asset_id])} post"
end
delete :index, :with => :asset_id do
"#{url_for(:index, params[:parent_id], :asset_id => params[:asset_id])} delete"
end
end
end
get "/parents/1/hi"
assert_equal "/parents/1/hi get", body
put "/parents/1/hi"
assert_equal "/parents/1/hi put", body
post "/parents/1/hi"
assert_equal "/parents/1/hi post", body
delete "/parents/1/hi"
assert_equal "/parents/1/hi delete", body
end
end