Permalink
Browse files

Add routing specs, reproduce routing bug

  • Loading branch information...
1 parent 6a7fb5a commit 5f548dab3949b7ebadcb51469b9702041f119053 @wojciech wojciech committed May 5, 2010
Showing with 18 additions and 0 deletions.
  1. +18 −0 test/unit/router_mixin/routes_spec.rb
@@ -51,5 +51,23 @@ def mock_request(path, method, params)
request.path_parameters.should == {"controller"=>"items", "action"=>"sdata_collection"}
end
+ it "recognizes route with predicate" do
+ request = mock_request("/items(id gt 1)", :get, {})
+ @router.recognize(request)
+ request.path_parameters.should == {"controller"=>"items", "action"=>"sdata_collection", "predicate"=>"id gt 1"}
+ end
+
+ it "recognizes route with linked collection" do
+ request = mock_request("/items/$linked", :get, {})
+ @router.recognize(request)
+ request.path_parameters.should == {"controller"=>"items", "action"=>"sdata_collection", "condition"=>"$linked" }
+ end
+
+ it "recognizes route with linked collection and predicate" do
+ request = mock_request("/items/$linked(name eq 'Second')", :get, {})
+ @router.recognize(request)
+ request.path_parameters.should == {"controller"=>"items", "action"=>"sdata_collection", "condition"=>"$linked", "predicate"=>"name eq 'Second'"}
+ end
+
end
end

0 comments on commit 5f548da

Please sign in to comment.