Fix routing/controller specs for refactored controllers

This commit is contained in:
Dmitriy Zaporozhets 2013-06-23 20:25:06 +03:00
parent 2ed7cbfba4
commit 40bca5246b
6 changed files with 100 additions and 100 deletions

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe BlobController do
describe Projects::BlobController do
let(:project) { create(:project_with_code) }
let(:user) { create(:user) }

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe CommitController do
describe Projects::CommitController do
let(:project) { create(:project_with_code) }
let(:user) { create(:user) }
let(:commit) { project.repository.last_commit_for("master") }

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe CommitsController do
describe Projects::CommitsController do
let(:project) { create(:project_with_code) }
let(:user) { create(:user) }

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe MergeRequestsController do
describe Projects::MergeRequestsController do
let(:project) { create(:project_with_code) }
let(:user) { create(:user) }
let(:merge_request) { create(:merge_request_with_diffs, project: project, target_branch: "bcf03b5d~3", source_branch: "bcf03b5d") }
@ -8,7 +8,7 @@ describe MergeRequestsController do
before do
sign_in(user)
project.team << [user, :master]
MergeRequestsController.any_instance.stub(validates_merge_request: true)
Projects::MergeRequestsController.any_instance.stub(validates_merge_request: true)
end
describe "#show" do

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe TreeController do
describe Projects::TreeController do
let(:project) { create(:project_with_code) }
let(:user) { create(:user) }

View file

@ -25,31 +25,31 @@ shared_examples "RESTful project resources" do
let(:actions) { [:index, :create, :new, :edit, :show, :update, :destroy] }
it "to #index" do
get("/gitlabhq/#{controller}").should route_to("#{controller}#index", project_id: 'gitlabhq') if actions.include?(:index)
get("/gitlabhq/#{controller}").should route_to("projects/#{controller}#index", project_id: 'gitlabhq') if actions.include?(:index)
end
it "to #create" do
post("/gitlabhq/#{controller}").should route_to("#{controller}#create", project_id: 'gitlabhq') if actions.include?(:create)
post("/gitlabhq/#{controller}").should route_to("projects/#{controller}#create", project_id: 'gitlabhq') if actions.include?(:create)
end
it "to #new" do
get("/gitlabhq/#{controller}/new").should route_to("#{controller}#new", project_id: 'gitlabhq') if actions.include?(:new)
get("/gitlabhq/#{controller}/new").should route_to("projects/#{controller}#new", project_id: 'gitlabhq') if actions.include?(:new)
end
it "to #edit" do
get("/gitlabhq/#{controller}/1/edit").should route_to("#{controller}#edit", project_id: 'gitlabhq', id: '1') if actions.include?(:edit)
get("/gitlabhq/#{controller}/1/edit").should route_to("projects/#{controller}#edit", project_id: 'gitlabhq', id: '1') if actions.include?(:edit)
end
it "to #show" do
get("/gitlabhq/#{controller}/1").should route_to("#{controller}#show", project_id: 'gitlabhq', id: '1') if actions.include?(:show)
get("/gitlabhq/#{controller}/1").should route_to("projects/#{controller}#show", project_id: 'gitlabhq', id: '1') if actions.include?(:show)
end
it "to #update" do
put("/gitlabhq/#{controller}/1").should route_to("#{controller}#update", project_id: 'gitlabhq', id: '1') if actions.include?(:update)
put("/gitlabhq/#{controller}/1").should route_to("projects/#{controller}#update", project_id: 'gitlabhq', id: '1') if actions.include?(:update)
end
it "to #destroy" do
delete("/gitlabhq/#{controller}/1").should route_to("#{controller}#destroy", project_id: 'gitlabhq', id: '1') if actions.include?(:destroy)
delete("/gitlabhq/#{controller}/1").should route_to("projects/#{controller}#destroy", project_id: 'gitlabhq', id: '1') if actions.include?(:destroy)
end
end
@ -76,7 +76,7 @@ describe ProjectsController, "routing" do
end
it "to #wall" do
get("/gitlabhq/wall").should route_to('walls#show', project_id: 'gitlabhq')
get("/gitlabhq/wall").should route_to('projects/walls#show', project_id: 'gitlabhq')
end
it "to #edit" do
@ -100,19 +100,19 @@ describe ProjectsController, "routing" do
end
end
# pages_project_wikis GET /:project_id/wikis/pages(.:format) wikis#pages
# history_project_wiki GET /:project_id/wikis/:id/history(.:format) wikis#history
# project_wikis POST /:project_id/wikis(.:format) wikis#create
# edit_project_wiki GET /:project_id/wikis/:id/edit(.:format) wikis#edit
# project_wiki GET /:project_id/wikis/:id(.:format) wikis#show
# DELETE /:project_id/wikis/:id(.:format) wikis#destroy
describe WikisController, "routing" do
# pages_project_wikis GET /:project_id/wikis/pages(.:format) projects/wikis#pages
# history_project_wiki GET /:project_id/wikis/:id/history(.:format) projects/wikis#history
# project_wikis POST /:project_id/wikis(.:format) projects/wikis#create
# edit_project_wiki GET /:project_id/wikis/:id/edit(.:format) projects/wikis#edit
# project_wiki GET /:project_id/wikis/:id(.:format) projects/wikis#show
# DELETE /:project_id/wikis/:id(.:format) projects/wikis#destroy
describe Projects::WikisController, "routing" do
it "to #pages" do
get("/gitlabhq/wikis/pages").should route_to('wikis#pages', project_id: 'gitlabhq')
get("/gitlabhq/wikis/pages").should route_to('projects/wikis#pages', project_id: 'gitlabhq')
end
it "to #history" do
get("/gitlabhq/wikis/1/history").should route_to('wikis#history', project_id: 'gitlabhq', id: '1')
get("/gitlabhq/wikis/1/history").should route_to('projects/wikis#history', project_id: 'gitlabhq', id: '1')
end
it_behaves_like "RESTful project resources" do
@ -121,25 +121,25 @@ describe WikisController, "routing" do
end
end
# branches_project_repository GET /:project_id/repository/branches(.:format) repositories#branches
# tags_project_repository GET /:project_id/repository/tags(.:format) repositories#tags
# archive_project_repository GET /:project_id/repository/archive(.:format) repositories#archive
# edit_project_repository GET /:project_id/repository/edit(.:format) repositories#edit
describe RepositoriesController, "routing" do
# branches_project_repository GET /:project_id/repository/branches(.:format) projects/repositories#branches
# tags_project_repository GET /:project_id/repository/tags(.:format) projects/repositories#tags
# archive_project_repository GET /:project_id/repository/archive(.:format) projects/repositories#archive
# edit_project_repository GET /:project_id/repository/edit(.:format) projects/repositories#edit
describe Projects::RepositoriesController, "routing" do
it "to #branches" do
get("/gitlabhq/repository/branches").should route_to('repositories#branches', project_id: 'gitlabhq')
get("/gitlabhq/repository/branches").should route_to('projects/repositories#branches', project_id: 'gitlabhq')
end
it "to #tags" do
get("/gitlabhq/repository/tags").should route_to('repositories#tags', project_id: 'gitlabhq')
get("/gitlabhq/repository/tags").should route_to('projects/repositories#tags', project_id: 'gitlabhq')
end
it "to #archive" do
get("/gitlabhq/repository/archive").should route_to('repositories#archive', project_id: 'gitlabhq')
get("/gitlabhq/repository/archive").should route_to('projects/repositories#archive', project_id: 'gitlabhq')
end
it "to #show" do
get("/gitlabhq/repository").should route_to('repositories#show', project_id: 'gitlabhq')
get("/gitlabhq/repository").should route_to('projects/repositories#show', project_id: 'gitlabhq')
end
end
@ -150,7 +150,7 @@ end
# project_deploy_key GET /:project_id/deploy_keys/:id(.:format) deploy_keys#show
# PUT /:project_id/deploy_keys/:id(.:format) deploy_keys#update
# DELETE /:project_id/deploy_keys/:id(.:format) deploy_keys#destroy
describe DeployKeysController, "routing" do
describe Projects::DeployKeysController, "routing" do
it_behaves_like "RESTful project resources" do
let(:controller) { 'deploy_keys' }
end
@ -159,7 +159,7 @@ end
# project_protected_branches GET /:project_id/protected_branches(.:format) protected_branches#index
# POST /:project_id/protected_branches(.:format) protected_branches#create
# project_protected_branch DELETE /:project_id/protected_branches/:id(.:format) protected_branches#destroy
describe ProtectedBranchesController, "routing" do
describe Projects::ProtectedBranchesController, "routing" do
it_behaves_like "RESTful project resources" do
let(:actions) { [:index, :create, :destroy] }
let(:controller) { 'protected_branches' }
@ -169,58 +169,58 @@ end
# switch_project_refs GET /:project_id/refs/switch(.:format) refs#switch
# logs_tree_project_ref GET /:project_id/refs/:id/logs_tree(.:format) refs#logs_tree
# logs_file_project_ref GET /:project_id/refs/:id/logs_tree/:path(.:format) refs#logs_tree
describe RefsController, "routing" do
describe Projects::RefsController, "routing" do
it "to #switch" do
get("/gitlabhq/refs/switch").should route_to('refs#switch', project_id: 'gitlabhq')
get("/gitlabhq/refs/switch").should route_to('projects/refs#switch', project_id: 'gitlabhq')
end
it "to #logs_tree" do
get("/gitlabhq/refs/stable/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable')
get("/gitlabhq/refs/feature%2345/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'feature#45')
get("/gitlabhq/refs/feature%2B45/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'feature+45')
get("/gitlabhq/refs/stable/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz')
get("/gitlabhq/refs/feature%2345/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'feature#45', path: 'foo/bar/baz')
get("/gitlabhq/refs/feature%2B45/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'feature+45', path: 'foo/bar/baz')
get("/gitlab/gitlabhq/refs/stable/logs_tree/files.scss").should route_to('refs#logs_tree', project_id: 'gitlab/gitlabhq', id: 'stable', path: 'files.scss')
get("/gitlabhq/refs/stable/logs_tree").should route_to('projects/refs#logs_tree', project_id: 'gitlabhq', id: 'stable')
get("/gitlabhq/refs/feature%2345/logs_tree").should route_to('projects/refs#logs_tree', project_id: 'gitlabhq', id: 'feature#45')
get("/gitlabhq/refs/feature%2B45/logs_tree").should route_to('projects/refs#logs_tree', project_id: 'gitlabhq', id: 'feature+45')
get("/gitlabhq/refs/stable/logs_tree/foo/bar/baz").should route_to('projects/refs#logs_tree', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz')
get("/gitlabhq/refs/feature%2345/logs_tree/foo/bar/baz").should route_to('projects/refs#logs_tree', project_id: 'gitlabhq', id: 'feature#45', path: 'foo/bar/baz')
get("/gitlabhq/refs/feature%2B45/logs_tree/foo/bar/baz").should route_to('projects/refs#logs_tree', project_id: 'gitlabhq', id: 'feature+45', path: 'foo/bar/baz')
get("/gitlab/gitlabhq/refs/stable/logs_tree/files.scss").should route_to('projects/refs#logs_tree', project_id: 'gitlab/gitlabhq', id: 'stable', path: 'files.scss')
end
end
# diffs_project_merge_request GET /:project_id/merge_requests/:id/diffs(.:format) merge_requests#diffs
# automerge_project_merge_request GET /:project_id/merge_requests/:id/automerge(.:format) merge_requests#automerge
# automerge_check_project_merge_request GET /:project_id/merge_requests/:id/automerge_check(.:format) merge_requests#automerge_check
# branch_from_project_merge_requests GET /:project_id/merge_requests/branch_from(.:format) merge_requests#branch_from
# branch_to_project_merge_requests GET /:project_id/merge_requests/branch_to(.:format) merge_requests#branch_to
# project_merge_requests GET /:project_id/merge_requests(.:format) merge_requests#index
# POST /:project_id/merge_requests(.:format) merge_requests#create
# new_project_merge_request GET /:project_id/merge_requests/new(.:format) merge_requests#new
# edit_project_merge_request GET /:project_id/merge_requests/:id/edit(.:format) merge_requests#edit
# project_merge_request GET /:project_id/merge_requests/:id(.:format) merge_requests#show
# PUT /:project_id/merge_requests/:id(.:format) merge_requests#update
# DELETE /:project_id/merge_requests/:id(.:format) merge_requests#destroy
describe MergeRequestsController, "routing" do
# diffs_project_merge_request GET /:project_id/merge_requests/:id/diffs(.:format) projects/merge_requests#diffs
# automerge_project_merge_request GET /:project_id/merge_requests/:id/automerge(.:format) projects/merge_requests#automerge
# automerge_check_project_merge_request GET /:project_id/merge_requests/:id/automerge_check(.:format) projects/merge_requests#automerge_check
# branch_from_project_merge_requests GET /:project_id/merge_requests/branch_from(.:format) projects/merge_requests#branch_from
# branch_to_project_merge_requests GET /:project_id/merge_requests/branch_to(.:format) projects/merge_requests#branch_to
# project_merge_requests GET /:project_id/merge_requests(.:format) projects/merge_requests#index
# POST /:project_id/merge_requests(.:format) projects/merge_requests#create
# new_project_merge_request GET /:project_id/merge_requests/new(.:format) projects/merge_requests#new
# edit_project_merge_request GET /:project_id/merge_requests/:id/edit(.:format) projects/merge_requests#edit
# project_merge_request GET /:project_id/merge_requests/:id(.:format) projects/merge_requests#show
# PUT /:project_id/merge_requests/:id(.:format) projects/merge_requests#update
# DELETE /:project_id/merge_requests/:id(.:format) projects/merge_requests#destroy
describe Projects::MergeRequestsController, "routing" do
it "to #diffs" do
get("/gitlabhq/merge_requests/1/diffs").should route_to('merge_requests#diffs', project_id: 'gitlabhq', id: '1')
get("/gitlabhq/merge_requests/1/diffs").should route_to('projects/merge_requests#diffs', project_id: 'gitlabhq', id: '1')
end
it "to #automerge" do
get("/gitlabhq/merge_requests/1/automerge").should route_to('merge_requests#automerge', project_id: 'gitlabhq', id: '1')
get("/gitlabhq/merge_requests/1/automerge").should route_to('projects/merge_requests#automerge', project_id: 'gitlabhq', id: '1')
end
it "to #automerge_check" do
get("/gitlabhq/merge_requests/1/automerge_check").should route_to('merge_requests#automerge_check', project_id: 'gitlabhq', id: '1')
get("/gitlabhq/merge_requests/1/automerge_check").should route_to('projects/merge_requests#automerge_check', project_id: 'gitlabhq', id: '1')
end
it "to #branch_from" do
get("/gitlabhq/merge_requests/branch_from").should route_to('merge_requests#branch_from', project_id: 'gitlabhq')
get("/gitlabhq/merge_requests/branch_from").should route_to('projects/merge_requests#branch_from', project_id: 'gitlabhq')
end
it "to #branch_to" do
get("/gitlabhq/merge_requests/branch_to").should route_to('merge_requests#branch_to', project_id: 'gitlabhq')
get("/gitlabhq/merge_requests/branch_to").should route_to('projects/merge_requests#branch_to', project_id: 'gitlabhq')
end
it "to #show" do
get("/gitlabhq/merge_requests/1.diff").should route_to('merge_requests#show', project_id: 'gitlabhq', id: '1', format: 'diff')
get("/gitlabhq/merge_requests/1.patch").should route_to('merge_requests#show', project_id: 'gitlabhq', id: '1', format: 'patch')
get("/gitlabhq/merge_requests/1.diff").should route_to('projects/merge_requests#show', project_id: 'gitlabhq', id: '1', format: 'diff')
get("/gitlabhq/merge_requests/1.patch").should route_to('projects/merge_requests#show', project_id: 'gitlabhq', id: '1', format: 'patch')
end
it_behaves_like "RESTful project resources" do
@ -275,9 +275,9 @@ end
# project_hooks GET /:project_id/hooks(.:format) hooks#index
# POST /:project_id/hooks(.:format) hooks#create
# project_hook DELETE /:project_id/hooks/:id(.:format) hooks#destroy
describe HooksController, "routing" do
describe Projects::HooksController, "routing" do
it "to #test" do
get("/gitlabhq/hooks/1/test").should route_to('hooks#test', project_id: 'gitlabhq', id: '1')
get("/gitlabhq/hooks/1/test").should route_to('projects/hooks#test', project_id: 'gitlabhq', id: '1')
end
it_behaves_like "RESTful project resources" do
@ -287,12 +287,12 @@ describe HooksController, "routing" do
end
# project_commit GET /:project_id/commit/:id(.:format) commit#show {id: /[[:alnum:]]{6,40}/, project_id: /[^\/]+/}
describe CommitController, "routing" do
describe Projects::CommitController, "routing" do
it "to #show" do
get("/gitlabhq/commit/4246fb").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb')
get("/gitlabhq/commit/4246fb.diff").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb', format: 'diff')
get("/gitlabhq/commit/4246fb.patch").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb', format: 'patch')
get("/gitlabhq/commit/4246fbd13872934f72a8fd0d6fb1317b47b59cb5").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fbd13872934f72a8fd0d6fb1317b47b59cb5')
get("/gitlabhq/commit/4246fb").should route_to('projects/commit#show', project_id: 'gitlabhq', id: '4246fb')
get("/gitlabhq/commit/4246fb.diff").should route_to('projects/commit#show', project_id: 'gitlabhq', id: '4246fb', format: 'diff')
get("/gitlabhq/commit/4246fb.patch").should route_to('projects/commit#show', project_id: 'gitlabhq', id: '4246fb', format: 'patch')
get("/gitlabhq/commit/4246fbd13872934f72a8fd0d6fb1317b47b59cb5").should route_to('projects/commit#show', project_id: 'gitlabhq', id: '4246fbd13872934f72a8fd0d6fb1317b47b59cb5')
end
end
@ -300,14 +300,14 @@ end
# project_commits GET /:project_id/commits(.:format) commits#index
# POST /:project_id/commits(.:format) commits#create
# project_commit GET /:project_id/commits/:id(.:format) commits#show
describe CommitsController, "routing" do
describe Projects::CommitsController, "routing" do
it_behaves_like "RESTful project resources" do
let(:actions) { [:show] }
let(:controller) { 'commits' }
end
it "to #show" do
get("/gitlab/gitlabhq/commits/master.atom").should route_to('commits#show', project_id: 'gitlab/gitlabhq', id: "master", format: "atom")
get("/gitlab/gitlabhq/commits/master.atom").should route_to('projects/commits#show', project_id: 'gitlab/gitlabhq', id: "master", format: "atom")
end
end
@ -318,7 +318,7 @@ end
# project_team_member GET /:project_id/team_members/:id(.:format) team_members#show
# PUT /:project_id/team_members/:id(.:format) team_members#update
# DELETE /:project_id/team_members/:id(.:format) team_members#destroy
describe TeamMembersController, "routing" do
describe Projects::TeamMembersController, "routing" do
it_behaves_like "RESTful project resources" do
let(:actions) { [:new, :create, :update, :destroy] }
let(:controller) { 'team_members' }
@ -332,7 +332,7 @@ end
# project_milestone GET /:project_id/milestones/:id(.:format) milestones#show
# PUT /:project_id/milestones/:id(.:format) milestones#update
# DELETE /:project_id/milestones/:id(.:format) milestones#destroy
describe MilestonesController, "routing" do
describe Projects::MilestonesController, "routing" do
it_behaves_like "RESTful project resources" do
let(:controller) { 'milestones' }
let(:actions) { [:index, :create, :new, :edit, :show, :update] }
@ -340,9 +340,9 @@ describe MilestonesController, "routing" do
end
# project_labels GET /:project_id/labels(.:format) labels#index
describe LabelsController, "routing" do
describe Projects::LabelsController, "routing" do
it "to #index" do
get("/gitlabhq/labels").should route_to('labels#index', project_id: 'gitlabhq')
get("/gitlabhq/labels").should route_to('projects/labels#index', project_id: 'gitlabhq')
end
end
@ -356,9 +356,9 @@ end
# project_issue GET /:project_id/issues/:id(.:format) issues#show
# PUT /:project_id/issues/:id(.:format) issues#update
# DELETE /:project_id/issues/:id(.:format) issues#destroy
describe IssuesController, "routing" do
describe Projects::IssuesController, "routing" do
it "to #bulk_update" do
post("/gitlabhq/issues/bulk_update").should route_to('issues#bulk_update', project_id: 'gitlabhq')
post("/gitlabhq/issues/bulk_update").should route_to('projects/issues#bulk_update', project_id: 'gitlabhq')
end
it_behaves_like "RESTful project resources" do
@ -371,9 +371,9 @@ end
# project_notes GET /:project_id/notes(.:format) notes#index
# POST /:project_id/notes(.:format) notes#create
# project_note DELETE /:project_id/notes/:id(.:format) notes#destroy
describe NotesController, "routing" do
describe Projects::NotesController, "routing" do
it "to #preview" do
post("/gitlabhq/notes/preview").should route_to('notes#preview', project_id: 'gitlabhq')
post("/gitlabhq/notes/preview").should route_to('projects/notes#preview', project_id: 'gitlabhq')
end
it_behaves_like "RESTful project resources" do
@ -383,57 +383,57 @@ describe NotesController, "routing" do
end
# project_blame GET /:project_id/blame/:id(.:format) blame#show {id: /.+/, project_id: /[^\/]+/}
describe BlameController, "routing" do
describe Projects::BlameController, "routing" do
it "to #show" do
get("/gitlabhq/blame/master/app/models/project.rb").should route_to('blame#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb')
get("/gitlab/gitlabhq/blame/master/files.scss").should route_to('blame#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss')
get("/gitlabhq/blame/master/app/models/project.rb").should route_to('projects/blame#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb')
get("/gitlab/gitlabhq/blame/master/files.scss").should route_to('projects/blame#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss')
end
end
# project_blob GET /:project_id/blob/:id(.:format) blob#show {id: /.+/, project_id: /[^\/]+/}
describe BlobController, "routing" do
describe Projects::BlobController, "routing" do
it "to #show" do
get("/gitlabhq/blob/master/app/models/project.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb')
get("/gitlabhq/blob/master/app/models/compare.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/compare.rb')
get("/gitlab/gitlabhq/blob/master/files.scss").should route_to('blob#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss')
get("/gitlabhq/blob/master/app/models/project.rb").should route_to('projects/blob#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb')
get("/gitlabhq/blob/master/app/models/compare.rb").should route_to('projects/blob#show', project_id: 'gitlabhq', id: 'master/app/models/compare.rb')
get("/gitlab/gitlabhq/blob/master/files.scss").should route_to('projects/blob#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss')
end
end
# project_tree GET /:project_id/tree/:id(.:format) tree#show {id: /.+/, project_id: /[^\/]+/}
describe TreeController, "routing" do
describe Projects::TreeController, "routing" do
it "to #show" do
get("/gitlabhq/tree/master/app/models/project.rb").should route_to('tree#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb')
get("/gitlab/gitlabhq/tree/master/files.scss").should route_to('tree#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss')
get("/gitlabhq/tree/master/app/models/project.rb").should route_to('projects/tree#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb')
get("/gitlab/gitlabhq/tree/master/files.scss").should route_to('projects/tree#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss')
end
end
# project_compare_index GET /:project_id/compare(.:format) compare#index {id: /[^\/]+/, project_id: /[^\/]+/}
# POST /:project_id/compare(.:format) compare#create {id: /[^\/]+/, project_id: /[^\/]+/}
# project_compare /:project_id/compare/:from...:to(.:format) compare#show {from: /.+/, to: /.+/, id: /[^\/]+/, project_id: /[^\/]+/}
describe CompareController, "routing" do
describe Projects::CompareController, "routing" do
it "to #index" do
get("/gitlabhq/compare").should route_to('compare#index', project_id: 'gitlabhq')
get("/gitlabhq/compare").should route_to('projects/compare#index', project_id: 'gitlabhq')
end
it "to #compare" do
post("/gitlabhq/compare").should route_to('compare#create', project_id: 'gitlabhq')
post("/gitlabhq/compare").should route_to('projects/compare#create', project_id: 'gitlabhq')
end
it "to #show" do
get("/gitlabhq/compare/master...stable").should route_to('compare#show', project_id: 'gitlabhq', from: 'master', to: 'stable')
get("/gitlabhq/compare/issue/1234...stable").should route_to('compare#show', project_id: 'gitlabhq', from: 'issue/1234', to: 'stable')
get("/gitlabhq/compare/master...stable").should route_to('projects/compare#show', project_id: 'gitlabhq', from: 'master', to: 'stable')
get("/gitlabhq/compare/issue/1234...stable").should route_to('projects/compare#show', project_id: 'gitlabhq', from: 'issue/1234', to: 'stable')
end
end
describe NetworkController, "routing" do
describe Projects::NetworkController, "routing" do
it "to #show" do
get("/gitlabhq/network/master").should route_to('network#show', project_id: 'gitlabhq', id: 'master')
get("/gitlabhq/network/master.json").should route_to('network#show', project_id: 'gitlabhq', id: 'master', format: "json")
get("/gitlabhq/network/master").should route_to('projects/network#show', project_id: 'gitlabhq', id: 'master')
get("/gitlabhq/network/master.json").should route_to('projects/network#show', project_id: 'gitlabhq', id: 'master', format: "json")
end
end
describe GraphsController, "routing" do
describe Projects::GraphsController, "routing" do
it "to #show" do
get("/gitlabhq/graphs/master").should route_to('graphs#show', project_id: 'gitlabhq', id: 'master')
get("/gitlabhq/graphs/master").should route_to('projects/graphs#show', project_id: 'gitlabhq', id: 'master')
end
end