Commit 6224ac064798e28a75bf14c7fcce5b8f2b58fca2
1 parent
6beae84e
Exists in
master
and in
4 other branches
Add and fix some tests for routing.
It is linked to #2598.
Showing
2 changed files
with
16 additions
and
6 deletions
Show diff stats
spec/controllers/commits_controller_spec.rb
| ... | ... | @@ -13,7 +13,7 @@ describe CommitsController do |
| 13 | 13 | describe "GET show" do |
| 14 | 14 | context "as atom feed" do |
| 15 | 15 | it "should render as atom" do |
| 16 | - get :show, project_id: project.path, id: "master.atom" | |
| 16 | + get :show, project_id: project.path, id: "master", format: "atom" | |
| 17 | 17 | response.should be_success |
| 18 | 18 | response.content_type.should == 'application/atom+xml' |
| 19 | 19 | end | ... | ... |
spec/routing/project_routing_spec.rb
| ... | ... | @@ -56,7 +56,6 @@ end |
| 56 | 56 | # projects POST /projects(.:format) projects#create |
| 57 | 57 | # new_project GET /projects/new(.:format) projects#new |
| 58 | 58 | # wall_project GET /:id/wall(.:format) projects#wall |
| 59 | -# graph_project GET /:id/graph(.:format) projects#graph | |
| 60 | 59 | # files_project GET /:id/files(.:format) projects#files |
| 61 | 60 | # edit_project GET /:id/edit(.:format) projects#edit |
| 62 | 61 | # project GET /:id(.:format) projects#show |
| ... | ... | @@ -75,10 +74,6 @@ describe ProjectsController, "routing" do |
| 75 | 74 | get("/gitlabhq/wall").should route_to('projects#wall', id: 'gitlabhq') |
| 76 | 75 | end |
| 77 | 76 | |
| 78 | - it "to #graph" do | |
| 79 | - get("/gitlabhq/graph/master").should route_to('graph#show', project_id: 'gitlabhq', id: 'master') | |
| 80 | - end | |
| 81 | - | |
| 82 | 77 | it "to #files" do |
| 83 | 78 | get("/gitlabhq/files").should route_to('projects#files', id: 'gitlabhq') |
| 84 | 79 | end |
| ... | ... | @@ -202,6 +197,7 @@ describe RefsController, "routing" do |
| 202 | 197 | it "to #logs_tree" do |
| 203 | 198 | get("/gitlabhq/refs/stable/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable') |
| 204 | 199 | get("/gitlabhq/refs/stable/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz') |
| 200 | + get("/gitlab/gitlabhq/refs/stable/logs_tree/files.scss").should route_to('refs#logs_tree', project_id: 'gitlab/gitlabhq', id: 'stable', path: 'files.scss') | |
| 205 | 201 | end |
| 206 | 202 | end |
| 207 | 203 | |
| ... | ... | @@ -301,6 +297,10 @@ describe CommitsController, "routing" do |
| 301 | 297 | let(:actions) { [:show] } |
| 302 | 298 | let(:controller) { 'commits' } |
| 303 | 299 | end |
| 300 | + | |
| 301 | + it "to #show" do | |
| 302 | + get("/gitlab/gitlabhq/commits/master.atom").should route_to('commits#show', project_id: 'gitlab/gitlabhq', id: "master", format: "atom") | |
| 303 | + end | |
| 304 | 304 | end |
| 305 | 305 | |
| 306 | 306 | # project_team_members GET /:project_id/team_members(.:format) team_members#index |
| ... | ... | @@ -385,6 +385,7 @@ end |
| 385 | 385 | describe BlameController, "routing" do |
| 386 | 386 | it "to #show" do |
| 387 | 387 | get("/gitlabhq/blame/master/app/models/project.rb").should route_to('blame#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') |
| 388 | + get("/gitlab/gitlabhq/blame/master/files.scss").should route_to('blame#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') | |
| 388 | 389 | end |
| 389 | 390 | end |
| 390 | 391 | |
| ... | ... | @@ -393,6 +394,7 @@ describe BlobController, "routing" do |
| 393 | 394 | it "to #show" do |
| 394 | 395 | get("/gitlabhq/blob/master/app/models/project.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') |
| 395 | 396 | get("/gitlabhq/blob/master/app/models/compare.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/compare.rb') |
| 397 | + get("/gitlab/gitlabhq/blob/master/files.scss").should route_to('blob#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') | |
| 396 | 398 | end |
| 397 | 399 | end |
| 398 | 400 | |
| ... | ... | @@ -400,6 +402,7 @@ end |
| 400 | 402 | describe TreeController, "routing" do |
| 401 | 403 | it "to #show" do |
| 402 | 404 | get("/gitlabhq/tree/master/app/models/project.rb").should route_to('tree#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') |
| 405 | + get("/gitlab/gitlabhq/tree/master/files.scss").should route_to('tree#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') | |
| 403 | 406 | end |
| 404 | 407 | end |
| 405 | 408 | |
| ... | ... | @@ -420,3 +423,10 @@ describe CompareController, "routing" do |
| 420 | 423 | get("/gitlabhq/compare/issue/1234...stable").should route_to('compare#show', project_id: 'gitlabhq', from: 'issue/1234', to: 'stable') |
| 421 | 424 | end |
| 422 | 425 | end |
| 426 | + | |
| 427 | +describe GraphController, "routing" do | |
| 428 | + it "to #show" do | |
| 429 | + get("/gitlabhq/graph/master").should route_to('graph#show', project_id: 'gitlabhq', id: 'master') | |
| 430 | + get("/gitlabhq/graph/master.json").should route_to('graph#show', project_id: 'gitlabhq', id: 'master', format: "json") | |
| 431 | + end | |
| 432 | +end | ... | ... |