Commit 7e8560649d117570855b4e807aa37497769ea699
- Date: Sat Jan 12 21:01:48 +0000 2008
- Committer: Johan Sørensen (johan@johansorensen.com)
- Author: Johan Sørensen (johan@johansorensen.com)
- Commit SHA1: 7e8560649d117570855b4e807aa37497769ea699
- Tree SHA1: 0fd85417e78b22a5270e1e99e612ac73a6247e23
Check Client#query_url against the actual routes
Commit diff
| |   |
| 23 | 23 | client.user_name.should == "johan" |
| 24 | 24 | end |
| 25 | 25 | |
| 26 | def make_request(path) |
| 27 | request = ActionController::TestRequest.new |
| 28 | request.request_uri = path |
| 29 | request |
| 30 | end |
| 31 | |
| 26 | 32 | it "has a query_url" do |
| 27 | 33 | client = Gitorious::SSH::Client.new(@strainer, "johan") |
| 28 | | exp_url = "/projects/foo/repos/bar/writable_by?username=johan" |
| 29 | | client.query_url.should == exp_url |
| 34 | # exp_url = "/projects/foo/repos/bar/writable_by?username=johan" |
| 35 | # client.query_url.should == exp_url |
| 36 | |
| 37 | request = make_request(client.query_url) |
| 38 | ActionController::Routing::Routes.recognize(request).should == RepositoriesController |
| 39 | # check against the actual routes |
| 40 | request.symbolized_path_parameters[:action].should == "writable_by" |
| 41 | request.symbolized_path_parameters[:controller].should == "repositories" |
| 42 | request.symbolized_path_parameters[:project_id].should == "foo" |
| 43 | request.symbolized_path_parameters[:id].should == "bar" |
| 30 | 44 | end |
| 31 | 45 | |
| 32 | 46 | it "asks the server if a user has permission" do |
| toggle raw diff |
--- a/spec/lib/gitorious/ssh/client_spec.rb
+++ b/spec/lib/gitorious/ssh/client_spec.rb
@@ -23,10 +23,24 @@ describe Gitorious::SSH::Client do
client.user_name.should == "johan"
end
+ def make_request(path)
+ request = ActionController::TestRequest.new
+ request.request_uri = path
+ request
+ end
+
it "has a query_url" do
client = Gitorious::SSH::Client.new(@strainer, "johan")
- exp_url = "/projects/foo/repos/bar/writable_by?username=johan"
- client.query_url.should == exp_url
+ # exp_url = "/projects/foo/repos/bar/writable_by?username=johan"
+ # client.query_url.should == exp_url
+
+ request = make_request(client.query_url)
+ ActionController::Routing::Routes.recognize(request).should == RepositoriesController
+ # check against the actual routes
+ request.symbolized_path_parameters[:action].should == "writable_by"
+ request.symbolized_path_parameters[:controller].should == "repositories"
+ request.symbolized_path_parameters[:project_id].should == "foo"
+ request.symbolized_path_parameters[:id].should == "bar"
end
it "asks the server if a user has permission" do |