Permalink
Browse files

Specs for get/post pass

  • Loading branch information...
1 parent 9bb41cc commit 4d45e4ac292a870e8d639e2c108420a081cf42bf Yehuda Katz committed Jul 17, 2008
@@ -4,7 +4,11 @@ def index
render
end
- def show
+ def get
+ ""
+ end
+
+ def post
""
end
@@ -53,8 +53,8 @@ def self.deactivate
# to avoid potential conflicts with global named routes.
def self.setup_router(scope)
# example of a named route
- scope.match(%r{(.*)}).defer_to do |req, params|
- {:controller => "merb_rest_server/rest", :action => "show"}
+ scope.match(%r{(.*)}).defer_to do |req, params|
+ {:controller => "merb_rest_server/rest", :action => req.method.to_s, :id => 1}
end
# scope.match('/index.:format').to(:controller => 'main', :action => 'index').name(:merb_rest_server_index)
end
@@ -14,7 +14,14 @@
it "routes GET /rest/foo/1 to Rest#show :id => 1" do
controller = get("/rest/foo/1")
- controller.action_name.should == "show"
+ controller.action_name.should == "get"
+ controller.params[:id].should == "1"
+ end
+
+ it "routes POST /rest/foo/1 to Rest#update :id => 1" do
+ controller = post("/rest/foo/1")
+ controller.action_name.should == "post"
+ controller.params[:id].should == "1"
end
# it "should have access to the slice module" do

0 comments on commit 4d45e4a

Please sign in to comment.