Commit 2898d923971e9e81452285be8d61c0643b3b8bbd
Exists in
master
and in
4 other branches
Merge pull request #4996 from hiroponz/drop-support-of-root-namespace
[WIP]Drop support of root namespace in routing
Showing
18 changed files
with
133 additions
and
150 deletions
Show diff stats
config/routes.rb
| @@ -157,7 +157,7 @@ Gitlab::Application.routes.draw do | @@ -157,7 +157,7 @@ Gitlab::Application.routes.draw do | ||
| 157 | # | 157 | # |
| 158 | # Project Area | 158 | # Project Area |
| 159 | # | 159 | # |
| 160 | - resources :projects, constraints: { id: /(?:[a-zA-Z.0-9_\-]+\/)?[a-zA-Z.0-9_\-]+/ }, except: [:new, :create, :index], path: "/" do | 160 | + resources :projects, constraints: { id: /[a-zA-Z.0-9_\-]+\/[a-zA-Z.0-9_\-]+/ }, except: [:new, :create, :index], path: "/" do |
| 161 | member do | 161 | member do |
| 162 | put :transfer | 162 | put :transfer |
| 163 | post :fork | 163 | post :fork |
| @@ -177,13 +177,13 @@ Gitlab::Application.routes.draw do | @@ -177,13 +177,13 @@ Gitlab::Application.routes.draw do | ||
| 177 | resources :graphs, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/} | 177 | resources :graphs, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/} |
| 178 | match "/compare/:from...:to" => "compare#show", as: "compare", via: [:get, :post], constraints: {from: /.+/, to: /.+/} | 178 | match "/compare/:from...:to" => "compare#show", as: "compare", via: [:get, :post], constraints: {from: /.+/, to: /.+/} |
| 179 | 179 | ||
| 180 | - resources :snippets do | 180 | + resources :snippets, constraints: {id: /\d+/} do |
| 181 | member do | 181 | member do |
| 182 | get "raw" | 182 | get "raw" |
| 183 | end | 183 | end |
| 184 | end | 184 | end |
| 185 | 185 | ||
| 186 | - resources :wikis, only: [:show, :edit, :destroy, :create] do | 186 | + resources :wikis, only: [:show, :edit, :destroy, :create], constraints: {id: /[a-zA-Z.0-9_\-]+/} do |
| 187 | collection do | 187 | collection do |
| 188 | get :pages | 188 | get :pages |
| 189 | put ':id' => 'wikis#update' | 189 | put ':id' => 'wikis#update' |
| @@ -195,7 +195,7 @@ Gitlab::Application.routes.draw do | @@ -195,7 +195,7 @@ Gitlab::Application.routes.draw do | ||
| 195 | end | 195 | end |
| 196 | end | 196 | end |
| 197 | 197 | ||
| 198 | - resource :wall, only: [:show] do | 198 | + resource :wall, only: [:show], constraints: {id: /\d+/} do |
| 199 | member do | 199 | member do |
| 200 | get 'notes' | 200 | get 'notes' |
| 201 | end | 201 | end |
| @@ -214,21 +214,21 @@ Gitlab::Application.routes.draw do | @@ -214,21 +214,21 @@ Gitlab::Application.routes.draw do | ||
| 214 | end | 214 | end |
| 215 | end | 215 | end |
| 216 | 216 | ||
| 217 | - resources :deploy_keys do | 217 | + resources :deploy_keys, constraints: {id: /\d+/} do |
| 218 | member do | 218 | member do |
| 219 | put :enable | 219 | put :enable |
| 220 | put :disable | 220 | put :disable |
| 221 | end | 221 | end |
| 222 | end | 222 | end |
| 223 | 223 | ||
| 224 | - resources :branches, only: [:index, :new, :create, :destroy] do | 224 | + resources :branches, only: [:index, :new, :create, :destroy], constraints: { id: /[a-zA-Z.\/0-9_\-#%+]+/ } do |
| 225 | collection do | 225 | collection do |
| 226 | get :recent | 226 | get :recent |
| 227 | end | 227 | end |
| 228 | end | 228 | end |
| 229 | 229 | ||
| 230 | - resources :tags, only: [:index, :new, :create, :destroy] | ||
| 231 | - resources :protected_branches, only: [:index, :create, :destroy] | 230 | + resources :tags, only: [:index, :new, :create, :destroy], constraints: { id: /[a-zA-Z.\/0-9_\-#%+]+/ } |
| 231 | + resources :protected_branches, only: [:index, :create, :destroy], constraints: { id: /[a-zA-Z.\/0-9_\-#%+]+/ } | ||
| 232 | 232 | ||
| 233 | resources :refs, only: [] do | 233 | resources :refs, only: [] do |
| 234 | collection do | 234 | collection do |
| @@ -262,14 +262,14 @@ Gitlab::Application.routes.draw do | @@ -262,14 +262,14 @@ Gitlab::Application.routes.draw do | ||
| 262 | end | 262 | end |
| 263 | end | 263 | end |
| 264 | 264 | ||
| 265 | - resources :hooks, only: [:index, :create, :destroy] do | 265 | + resources :hooks, only: [:index, :create, :destroy], constraints: {id: /\d+/} do |
| 266 | member do | 266 | member do |
| 267 | get :test | 267 | get :test |
| 268 | end | 268 | end |
| 269 | end | 269 | end |
| 270 | 270 | ||
| 271 | resources :team, controller: 'team_members', only: [:index] | 271 | resources :team, controller: 'team_members', only: [:index] |
| 272 | - resources :milestones, except: [:destroy] | 272 | + resources :milestones, except: [:destroy], constraints: {id: /\d+/} |
| 273 | 273 | ||
| 274 | resources :labels, only: [:index] do | 274 | resources :labels, only: [:index] do |
| 275 | collection do | 275 | collection do |
| @@ -283,7 +283,7 @@ Gitlab::Application.routes.draw do | @@ -283,7 +283,7 @@ Gitlab::Application.routes.draw do | ||
| 283 | end | 283 | end |
| 284 | end | 284 | end |
| 285 | 285 | ||
| 286 | - resources :team_members, except: [:index, :edit] do | 286 | + resources :team_members, except: [:index, :edit], constraints: { id: /[a-zA-Z.\/0-9_\-#%+]+/ } do |
| 287 | collection do | 287 | collection do |
| 288 | 288 | ||
| 289 | # Used for import team | 289 | # Used for import team |
| @@ -293,7 +293,7 @@ Gitlab::Application.routes.draw do | @@ -293,7 +293,7 @@ Gitlab::Application.routes.draw do | ||
| 293 | end | 293 | end |
| 294 | end | 294 | end |
| 295 | 295 | ||
| 296 | - resources :notes, only: [:index, :create, :destroy, :update] do | 296 | + resources :notes, only: [:index, :create, :destroy, :update], constraints: {id: /\d+/} do |
| 297 | member do | 297 | member do |
| 298 | delete :delete_attachment | 298 | delete :delete_attachment |
| 299 | end | 299 | end |
features/steps/dashboard/dashboard.rb
| @@ -57,7 +57,7 @@ class Dashboard < Spinach::FeatureSteps | @@ -57,7 +57,7 @@ class Dashboard < Spinach::FeatureSteps | ||
| 57 | 57 | ||
| 58 | And 'I have group with projects' do | 58 | And 'I have group with projects' do |
| 59 | @group = create(:group) | 59 | @group = create(:group) |
| 60 | - @project = create(:project, group: @group) | 60 | + @project = create(:project, namespace: @group) |
| 61 | @event = create(:closed_issue_event, project: @project) | 61 | @event = create(:closed_issue_event, project: @project) |
| 62 | 62 | ||
| 63 | @project.team << [current_user, :master] | 63 | @project.team << [current_user, :master] |
features/steps/group/group.rb
| @@ -11,7 +11,7 @@ class Groups < Spinach::FeatureSteps | @@ -11,7 +11,7 @@ class Groups < Spinach::FeatureSteps | ||
| 11 | 11 | ||
| 12 | And 'I have group with projects' do | 12 | And 'I have group with projects' do |
| 13 | @group = create(:group, owner: current_user) | 13 | @group = create(:group, owner: current_user) |
| 14 | - @project = create(:project, group: @group) | 14 | + @project = create(:project, namespace: @group) |
| 15 | @event = create(:closed_issue_event, project: @project) | 15 | @event = create(:closed_issue_event, project: @project) |
| 16 | 16 | ||
| 17 | @project.team << [current_user, :master] | 17 | @project.team << [current_user, :master] |
features/steps/project/project_network_graph.rb
| @@ -38,11 +38,6 @@ class ProjectNetworkGraph < Spinach::FeatureSteps | @@ -38,11 +38,6 @@ class ProjectNetworkGraph < Spinach::FeatureSteps | ||
| 38 | sleep 2 | 38 | sleep 2 |
| 39 | end | 39 | end |
| 40 | 40 | ||
| 41 | - When 'I switch ref to "v2.1.0"' do | ||
| 42 | - page.select 'v2.1.0', from: 'ref' | ||
| 43 | - sleep 2 | ||
| 44 | - end | ||
| 45 | - | ||
| 46 | When 'click "Show only selected branch" checkbox' do | 41 | When 'click "Show only selected branch" checkbox' do |
| 47 | find('#filter_ref').click | 42 | find('#filter_ref').click |
| 48 | sleep 2 | 43 | sleep 2 |
features/support/env.rb
| @@ -26,10 +26,13 @@ WebMock.allow_net_connect! | @@ -26,10 +26,13 @@ WebMock.allow_net_connect! | ||
| 26 | # | 26 | # |
| 27 | require 'capybara/poltergeist' | 27 | require 'capybara/poltergeist' |
| 28 | Capybara.javascript_driver = :poltergeist | 28 | Capybara.javascript_driver = :poltergeist |
| 29 | +Capybara.register_driver :poltergeist do |app| | ||
| 30 | + Capybara::Poltergeist::Driver.new(app, :js_errors => false, :timeout => 60) | ||
| 31 | +end | ||
| 29 | Spinach.hooks.on_tag("javascript") do | 32 | Spinach.hooks.on_tag("javascript") do |
| 30 | ::Capybara.current_driver = ::Capybara.javascript_driver | 33 | ::Capybara.current_driver = ::Capybara.javascript_driver |
| 31 | end | 34 | end |
| 32 | -Capybara.default_wait_time = 10 | 35 | +Capybara.default_wait_time = 60 |
| 33 | Capybara.ignore_hidden_elements = false | 36 | Capybara.ignore_hidden_elements = false |
| 34 | 37 | ||
| 35 | DatabaseCleaner.strategy = :truncation | 38 | DatabaseCleaner.strategy = :truncation |
lib/api/merge_requests.rb
| @@ -4,7 +4,7 @@ module API | @@ -4,7 +4,7 @@ module API | ||
| 4 | before { authenticate! } | 4 | before { authenticate! } |
| 5 | before { Thread.current[:current_user] = current_user } | 5 | before { Thread.current[:current_user] = current_user } |
| 6 | 6 | ||
| 7 | - resource :projects do | 7 | + resource :projects, requirements: { id: /[a-zA-Z.0-9_\-]+\/[a-zA-Z.0-9_\-]+/ } do |
| 8 | helpers do | 8 | helpers do |
| 9 | def handle_merge_request_errors!(errors) | 9 | def handle_merge_request_errors!(errors) |
| 10 | if errors[:project_access].any? | 10 | if errors[:project_access].any? |
spec/controllers/blob_controller_spec.rb
| @@ -17,7 +17,7 @@ describe Projects::BlobController do | @@ -17,7 +17,7 @@ describe Projects::BlobController do | ||
| 17 | describe "GET show" do | 17 | describe "GET show" do |
| 18 | render_views | 18 | render_views |
| 19 | 19 | ||
| 20 | - before { get :show, project_id: project.code, id: id } | 20 | + before { get :show, project_id: project.to_param, id: id } |
| 21 | 21 | ||
| 22 | context "valid branch, valid file" do | 22 | context "valid branch, valid file" do |
| 23 | let(:id) { 'master/README.md' } | 23 | let(:id) { 'master/README.md' } |
spec/controllers/commit_controller_spec.rb
| @@ -13,7 +13,7 @@ describe Projects::CommitController do | @@ -13,7 +13,7 @@ describe Projects::CommitController do | ||
| 13 | describe "#show" do | 13 | describe "#show" do |
| 14 | shared_examples "export as" do |format| | 14 | shared_examples "export as" do |format| |
| 15 | it "should generally work" do | 15 | it "should generally work" do |
| 16 | - get :show, project_id: project.code, id: commit.id, format: format | 16 | + get :show, project_id: project.to_param, id: commit.id, format: format |
| 17 | 17 | ||
| 18 | expect(response).to be_success | 18 | expect(response).to be_success |
| 19 | end | 19 | end |
| @@ -21,11 +21,11 @@ describe Projects::CommitController do | @@ -21,11 +21,11 @@ describe Projects::CommitController do | ||
| 21 | it "should generate it" do | 21 | it "should generate it" do |
| 22 | Commit.any_instance.should_receive(:"to_#{format}") | 22 | Commit.any_instance.should_receive(:"to_#{format}") |
| 23 | 23 | ||
| 24 | - get :show, project_id: project.code, id: commit.id, format: format | 24 | + get :show, project_id: project.to_param, id: commit.id, format: format |
| 25 | end | 25 | end |
| 26 | 26 | ||
| 27 | it "should render it" do | 27 | it "should render it" do |
| 28 | - get :show, project_id: project.code, id: commit.id, format: format | 28 | + get :show, project_id: project.to_param, id: commit.id, format: format |
| 29 | 29 | ||
| 30 | expect(response.body).to eq(commit.send(:"to_#{format}")) | 30 | expect(response.body).to eq(commit.send(:"to_#{format}")) |
| 31 | end | 31 | end |
| @@ -33,7 +33,7 @@ describe Projects::CommitController do | @@ -33,7 +33,7 @@ describe Projects::CommitController do | ||
| 33 | it "should not escape Html" do | 33 | it "should not escape Html" do |
| 34 | Commit.any_instance.stub(:"to_#{format}").and_return('HTML entities &<>" ') | 34 | Commit.any_instance.stub(:"to_#{format}").and_return('HTML entities &<>" ') |
| 35 | 35 | ||
| 36 | - get :show, project_id: project.code, id: commit.id, format: format | 36 | + get :show, project_id: project.to_param, id: commit.id, format: format |
| 37 | 37 | ||
| 38 | expect(response.body).to_not include('&') | 38 | expect(response.body).to_not include('&') |
| 39 | expect(response.body).to_not include('>') | 39 | expect(response.body).to_not include('>') |
| @@ -47,7 +47,7 @@ describe Projects::CommitController do | @@ -47,7 +47,7 @@ describe Projects::CommitController do | ||
| 47 | let(:format) { :diff } | 47 | let(:format) { :diff } |
| 48 | 48 | ||
| 49 | it "should really only be a git diff" do | 49 | it "should really only be a git diff" do |
| 50 | - get :show, project_id: project.code, id: commit.id, format: format | 50 | + get :show, project_id: project.to_param, id: commit.id, format: format |
| 51 | 51 | ||
| 52 | expect(response.body).to start_with("diff --git") | 52 | expect(response.body).to start_with("diff --git") |
| 53 | end | 53 | end |
| @@ -58,13 +58,13 @@ describe Projects::CommitController do | @@ -58,13 +58,13 @@ describe Projects::CommitController do | ||
| 58 | let(:format) { :patch } | 58 | let(:format) { :patch } |
| 59 | 59 | ||
| 60 | it "should really be a git email patch" do | 60 | it "should really be a git email patch" do |
| 61 | - get :show, project_id: project.code, id: commit.id, format: format | 61 | + get :show, project_id: project.to_param, id: commit.id, format: format |
| 62 | 62 | ||
| 63 | expect(response.body).to start_with("From #{commit.id}") | 63 | expect(response.body).to start_with("From #{commit.id}") |
| 64 | end | 64 | end |
| 65 | 65 | ||
| 66 | it "should contain a git diff" do | 66 | it "should contain a git diff" do |
| 67 | - get :show, project_id: project.code, id: commit.id, format: format | 67 | + get :show, project_id: project.to_param, id: commit.id, format: format |
| 68 | 68 | ||
| 69 | expect(response.body).to match(/^diff --git/) | 69 | expect(response.body).to match(/^diff --git/) |
| 70 | end | 70 | end |
spec/controllers/commits_controller_spec.rb
| @@ -13,7 +13,7 @@ describe Projects::CommitsController do | @@ -13,7 +13,7 @@ describe Projects::CommitsController do | ||
| 13 | describe "GET show" do | 13 | describe "GET show" do |
| 14 | context "as atom feed" do | 14 | context "as atom feed" do |
| 15 | it "should render as atom" do | 15 | it "should render as atom" do |
| 16 | - get :show, project_id: project.path, id: "master", format: "atom" | 16 | + get :show, project_id: project.to_param, id: "master", format: "atom" |
| 17 | response.should be_success | 17 | response.should be_success |
| 18 | response.content_type.should == 'application/atom+xml' | 18 | response.content_type.should == 'application/atom+xml' |
| 19 | end | 19 | end |
spec/controllers/merge_requests_controller_spec.rb
| @@ -14,7 +14,7 @@ describe Projects::MergeRequestsController do | @@ -14,7 +14,7 @@ describe Projects::MergeRequestsController do | ||
| 14 | describe "#show" do | 14 | describe "#show" do |
| 15 | shared_examples "export merge as" do |format| | 15 | shared_examples "export merge as" do |format| |
| 16 | it "should generally work" do | 16 | it "should generally work" do |
| 17 | - get :show, project_id: project.code, id: merge_request.iid, format: format | 17 | + get :show, project_id: project.to_param, id: merge_request.iid, format: format |
| 18 | 18 | ||
| 19 | expect(response).to be_success | 19 | expect(response).to be_success |
| 20 | end | 20 | end |
| @@ -22,11 +22,11 @@ describe Projects::MergeRequestsController do | @@ -22,11 +22,11 @@ describe Projects::MergeRequestsController do | ||
| 22 | it "should generate it" do | 22 | it "should generate it" do |
| 23 | MergeRequest.any_instance.should_receive(:"to_#{format}") | 23 | MergeRequest.any_instance.should_receive(:"to_#{format}") |
| 24 | 24 | ||
| 25 | - get :show, project_id: project.code, id: merge_request.iid, format: format | 25 | + get :show, project_id: project.to_param, id: merge_request.iid, format: format |
| 26 | end | 26 | end |
| 27 | 27 | ||
| 28 | it "should render it" do | 28 | it "should render it" do |
| 29 | - get :show, project_id: project.code, id: merge_request.iid, format: format | 29 | + get :show, project_id: project.to_param, id: merge_request.iid, format: format |
| 30 | 30 | ||
| 31 | expect(response.body).to eq((merge_request.send(:"to_#{format}",user)).to_s) | 31 | expect(response.body).to eq((merge_request.send(:"to_#{format}",user)).to_s) |
| 32 | end | 32 | end |
| @@ -34,7 +34,7 @@ describe Projects::MergeRequestsController do | @@ -34,7 +34,7 @@ describe Projects::MergeRequestsController do | ||
| 34 | it "should not escape Html" do | 34 | it "should not escape Html" do |
| 35 | MergeRequest.any_instance.stub(:"to_#{format}").and_return('HTML entities &<>" ') | 35 | MergeRequest.any_instance.stub(:"to_#{format}").and_return('HTML entities &<>" ') |
| 36 | 36 | ||
| 37 | - get :show, project_id: project.code, id: merge_request.iid, format: format | 37 | + get :show, project_id: project.to_param, id: merge_request.iid, format: format |
| 38 | 38 | ||
| 39 | expect(response.body).to_not include('&') | 39 | expect(response.body).to_not include('&') |
| 40 | expect(response.body).to_not include('>') | 40 | expect(response.body).to_not include('>') |
| @@ -48,7 +48,7 @@ describe Projects::MergeRequestsController do | @@ -48,7 +48,7 @@ describe Projects::MergeRequestsController do | ||
| 48 | let(:format) { :diff } | 48 | let(:format) { :diff } |
| 49 | 49 | ||
| 50 | it "should really only be a git diff" do | 50 | it "should really only be a git diff" do |
| 51 | - get :show, project_id: project.code, id: merge_request.iid, format: format | 51 | + get :show, project_id: project.to_param, id: merge_request.iid, format: format |
| 52 | 52 | ||
| 53 | expect(response.body).to start_with("diff --git") | 53 | expect(response.body).to start_with("diff --git") |
| 54 | end | 54 | end |
| @@ -59,13 +59,13 @@ describe Projects::MergeRequestsController do | @@ -59,13 +59,13 @@ describe Projects::MergeRequestsController do | ||
| 59 | let(:format) { :patch } | 59 | let(:format) { :patch } |
| 60 | 60 | ||
| 61 | it "should really be a git email patch with commit" do | 61 | it "should really be a git email patch with commit" do |
| 62 | - get :show, project_id: project.code, id: merge_request.iid, format: format | 62 | + get :show, project_id: project.to_param, id: merge_request.iid, format: format |
| 63 | 63 | ||
| 64 | expect(response.body[0..100]).to start_with("From #{merge_request.commits.last.id}") | 64 | expect(response.body[0..100]).to start_with("From #{merge_request.commits.last.id}") |
| 65 | end | 65 | end |
| 66 | 66 | ||
| 67 | it "should contain git diffs" do | 67 | it "should contain git diffs" do |
| 68 | - get :show, project_id: project.code, id: merge_request.iid, format: format | 68 | + get :show, project_id: project.to_param, id: merge_request.iid, format: format |
| 69 | 69 | ||
| 70 | expect(response.body).to match(/^diff --git/) | 70 | expect(response.body).to match(/^diff --git/) |
| 71 | end | 71 | end |
spec/controllers/tree_controller_spec.rb
| @@ -18,7 +18,7 @@ describe Projects::TreeController do | @@ -18,7 +18,7 @@ describe Projects::TreeController do | ||
| 18 | # Make sure any errors accessing the tree in our views bubble up to this spec | 18 | # Make sure any errors accessing the tree in our views bubble up to this spec |
| 19 | render_views | 19 | render_views |
| 20 | 20 | ||
| 21 | - before { get :show, project_id: project.code, id: id } | 21 | + before { get :show, project_id: project.to_param, id: id } |
| 22 | 22 | ||
| 23 | context "valid branch, no path" do | 23 | context "valid branch, no path" do |
| 24 | let(:id) { 'master' } | 24 | let(:id) { 'master' } |
spec/factories.rb
| @@ -28,6 +28,7 @@ FactoryGirl.define do | @@ -28,6 +28,7 @@ FactoryGirl.define do | ||
| 28 | factory :project do | 28 | factory :project do |
| 29 | sequence(:name) { |n| "project#{n}" } | 29 | sequence(:name) { |n| "project#{n}" } |
| 30 | path { name.downcase.gsub(/\s/, '_') } | 30 | path { name.downcase.gsub(/\s/, '_') } |
| 31 | + namespace | ||
| 31 | creator | 32 | creator |
| 32 | 33 | ||
| 33 | trait :source do | 34 | trait :source do |
spec/features/atom/issues_spec.rb
| @@ -3,7 +3,7 @@ require 'spec_helper' | @@ -3,7 +3,7 @@ require 'spec_helper' | ||
| 3 | describe "Issues Feed" do | 3 | describe "Issues Feed" do |
| 4 | describe "GET /issues" do | 4 | describe "GET /issues" do |
| 5 | let!(:user) { create(:user) } | 5 | let!(:user) { create(:user) } |
| 6 | - let!(:project) { create(:project, namespace: user.namespace) } | 6 | + let!(:project) { create(:project) } |
| 7 | let!(:issue) { create(:issue, author: user, project: project) } | 7 | let!(:issue) { create(:issue, author: user, project: project) } |
| 8 | 8 | ||
| 9 | before { project.team << [user, :developer] } | 9 | before { project.team << [user, :developer] } |
spec/models/project_spec.rb
| @@ -58,11 +58,11 @@ describe Project do | @@ -58,11 +58,11 @@ describe Project do | ||
| 58 | let!(:project) { create(:project) } | 58 | let!(:project) { create(:project) } |
| 59 | 59 | ||
| 60 | it { should validate_presence_of(:name) } | 60 | it { should validate_presence_of(:name) } |
| 61 | - it { should validate_uniqueness_of(:name) } | 61 | + it { should validate_uniqueness_of(:name).scoped_to(:namespace_id) } |
| 62 | it { should ensure_length_of(:name).is_within(0..255) } | 62 | it { should ensure_length_of(:name).is_within(0..255) } |
| 63 | 63 | ||
| 64 | it { should validate_presence_of(:path) } | 64 | it { should validate_presence_of(:path) } |
| 65 | - it { should validate_uniqueness_of(:path) } | 65 | + it { should validate_uniqueness_of(:path).scoped_to(:namespace_id) } |
| 66 | it { should ensure_length_of(:path).is_within(0..255) } | 66 | it { should ensure_length_of(:path).is_within(0..255) } |
| 67 | it { should ensure_length_of(:description).is_within(0..2000) } | 67 | it { should ensure_length_of(:description).is_within(0..2000) } |
| 68 | it { should validate_presence_of(:creator) } | 68 | it { should validate_presence_of(:creator) } |
| @@ -157,15 +157,6 @@ describe Project do | @@ -157,15 +157,6 @@ describe Project do | ||
| 157 | it { Project.find_with_namespace('gitlab/gitlab-ci').should == @project } | 157 | it { Project.find_with_namespace('gitlab/gitlab-ci').should == @project } |
| 158 | it { Project.find_with_namespace('gitlab-ci').should be_nil } | 158 | it { Project.find_with_namespace('gitlab-ci').should be_nil } |
| 159 | end | 159 | end |
| 160 | - | ||
| 161 | - context 'w/o namespace' do | ||
| 162 | - before do | ||
| 163 | - @project = create(:project, name: 'gitlab-ci') | ||
| 164 | - end | ||
| 165 | - | ||
| 166 | - it { Project.find_with_namespace('gitlab-ci').should == @project } | ||
| 167 | - it { Project.find_with_namespace('gitlab/gitlab-ci').should be_nil } | ||
| 168 | - end | ||
| 169 | end | 160 | end |
| 170 | 161 | ||
| 171 | describe :to_param do | 162 | describe :to_param do |
| @@ -177,14 +168,6 @@ describe Project do | @@ -177,14 +168,6 @@ describe Project do | ||
| 177 | 168 | ||
| 178 | it { @project.to_param.should == "gitlab/gitlab-ci" } | 169 | it { @project.to_param.should == "gitlab/gitlab-ci" } |
| 179 | end | 170 | end |
| 180 | - | ||
| 181 | - context 'w/o namespace' do | ||
| 182 | - before do | ||
| 183 | - @project = create(:project, name: 'gitlab-ci') | ||
| 184 | - end | ||
| 185 | - | ||
| 186 | - it { @project.to_param.should == "gitlab-ci" } | ||
| 187 | - end | ||
| 188 | end | 171 | end |
| 189 | 172 | ||
| 190 | describe :repository do | 173 | describe :repository do |
spec/requests/api/merge_requests_spec.rb
| @@ -2,9 +2,10 @@ require "spec_helper" | @@ -2,9 +2,10 @@ require "spec_helper" | ||
| 2 | 2 | ||
| 3 | describe API::API do | 3 | describe API::API do |
| 4 | include ApiHelpers | 4 | include ApiHelpers |
| 5 | - | 5 | + before(:each) { ActiveRecord::Base.observers.enable(:user_observer) } |
| 6 | + after(:each) { ActiveRecord::Base.observers.disable(:user_observer) } | ||
| 6 | let(:user) { create(:user) } | 7 | let(:user) { create(:user) } |
| 7 | - let!(:project) {create(:project_with_code, creator_id: user.id) } | 8 | + let!(:project) {create(:project_with_code, creator_id: user.id, namespace: user.namespace) } |
| 8 | let!(:merge_request) { create(:merge_request, author: user, assignee: user, source_project: project, target_project: project, title: "Test") } | 9 | let!(:merge_request) { create(:merge_request, author: user, assignee: user, source_project: project, target_project: project, title: "Test") } |
| 9 | before { | 10 | before { |
| 10 | project.team << [user, :reporters] | 11 | project.team << [user, :reporters] |
| @@ -13,14 +14,14 @@ describe API::API do | @@ -13,14 +14,14 @@ describe API::API do | ||
| 13 | describe "GET /projects/:id/merge_requests" do | 14 | describe "GET /projects/:id/merge_requests" do |
| 14 | context "when unauthenticated" do | 15 | context "when unauthenticated" do |
| 15 | it "should return authentication error" do | 16 | it "should return authentication error" do |
| 16 | - get api("/projects/#{project.id}/merge_requests") | 17 | + get api("/projects/#{project.to_param}/merge_requests") |
| 17 | response.status.should == 401 | 18 | response.status.should == 401 |
| 18 | end | 19 | end |
| 19 | end | 20 | end |
| 20 | 21 | ||
| 21 | context "when authenticated" do | 22 | context "when authenticated" do |
| 22 | it "should return an array of merge_requests" do | 23 | it "should return an array of merge_requests" do |
| 23 | - get api("/projects/#{project.id}/merge_requests", user) | 24 | + get api("/projects/#{project.to_param}/merge_requests", user) |
| 24 | response.status.should == 200 | 25 | response.status.should == 200 |
| 25 | json_response.should be_an Array | 26 | json_response.should be_an Array |
| 26 | json_response.first['title'].should == merge_request.title | 27 | json_response.first['title'].should == merge_request.title |
| @@ -30,13 +31,13 @@ describe API::API do | @@ -30,13 +31,13 @@ describe API::API do | ||
| 30 | 31 | ||
| 31 | describe "GET /projects/:id/merge_request/:merge_request_id" do | 32 | describe "GET /projects/:id/merge_request/:merge_request_id" do |
| 32 | it "should return merge_request" do | 33 | it "should return merge_request" do |
| 33 | - get api("/projects/#{project.id}/merge_request/#{merge_request.id}", user) | 34 | + get api("/projects/#{project.to_param}/merge_request/#{merge_request.id}", user) |
| 34 | response.status.should == 200 | 35 | response.status.should == 200 |
| 35 | json_response['title'].should == merge_request.title | 36 | json_response['title'].should == merge_request.title |
| 36 | end | 37 | end |
| 37 | 38 | ||
| 38 | it "should return a 404 error if merge_request_id not found" do | 39 | it "should return a 404 error if merge_request_id not found" do |
| 39 | - get api("/projects/#{project.id}/merge_request/999", user) | 40 | + get api("/projects/#{project.to_param}/merge_request/999", user) |
| 40 | response.status.should == 404 | 41 | response.status.should == 404 |
| 41 | end | 42 | end |
| 42 | end | 43 | end |
| @@ -44,32 +45,32 @@ describe API::API do | @@ -44,32 +45,32 @@ describe API::API do | ||
| 44 | describe "POST /projects/:id/merge_requests" do | 45 | describe "POST /projects/:id/merge_requests" do |
| 45 | context 'between branches projects' do | 46 | context 'between branches projects' do |
| 46 | it "should return merge_request" do | 47 | it "should return merge_request" do |
| 47 | - post api("/projects/#{project.id}/merge_requests", user), | 48 | + post api("/projects/#{project.to_param}/merge_requests", user), |
| 48 | title: 'Test merge_request', source_branch: "stable", target_branch: "master", author: user | 49 | title: 'Test merge_request', source_branch: "stable", target_branch: "master", author: user |
| 49 | response.status.should == 201 | 50 | response.status.should == 201 |
| 50 | json_response['title'].should == 'Test merge_request' | 51 | json_response['title'].should == 'Test merge_request' |
| 51 | end | 52 | end |
| 52 | 53 | ||
| 53 | it "should return 422 when source_branch equals target_branch" do | 54 | it "should return 422 when source_branch equals target_branch" do |
| 54 | - post api("/projects/#{project.id}/merge_requests", user), | 55 | + post api("/projects/#{project.to_param}/merge_requests", user), |
| 55 | title: "Test merge_request", source_branch: "master", target_branch: "master", author: user | 56 | title: "Test merge_request", source_branch: "master", target_branch: "master", author: user |
| 56 | response.status.should == 422 | 57 | response.status.should == 422 |
| 57 | end | 58 | end |
| 58 | 59 | ||
| 59 | it "should return 400 when source_branch is missing" do | 60 | it "should return 400 when source_branch is missing" do |
| 60 | - post api("/projects/#{project.id}/merge_requests", user), | 61 | + post api("/projects/#{project.to_param}/merge_requests", user), |
| 61 | title: "Test merge_request", target_branch: "master", author: user | 62 | title: "Test merge_request", target_branch: "master", author: user |
| 62 | response.status.should == 400 | 63 | response.status.should == 400 |
| 63 | end | 64 | end |
| 64 | 65 | ||
| 65 | it "should return 400 when target_branch is missing" do | 66 | it "should return 400 when target_branch is missing" do |
| 66 | - post api("/projects/#{project.id}/merge_requests", user), | 67 | + post api("/projects/#{project.to_param}/merge_requests", user), |
| 67 | title: "Test merge_request", source_branch: "stable", author: user | 68 | title: "Test merge_request", source_branch: "stable", author: user |
| 68 | response.status.should == 400 | 69 | response.status.should == 400 |
| 69 | end | 70 | end |
| 70 | 71 | ||
| 71 | it "should return 400 when title is missing" do | 72 | it "should return 400 when title is missing" do |
| 72 | - post api("/projects/#{project.id}/merge_requests", user), | 73 | + post api("/projects/#{project.to_param}/merge_requests", user), |
| 73 | target_branch: 'master', source_branch: 'stable' | 74 | target_branch: 'master', source_branch: 'stable' |
| 74 | response.status.should == 400 | 75 | response.status.should == 400 |
| 75 | end | 76 | end |
| @@ -89,54 +90,54 @@ describe API::API do | @@ -89,54 +90,54 @@ describe API::API do | ||
| 89 | end | 90 | end |
| 90 | 91 | ||
| 91 | it "should return merge_request" do | 92 | it "should return merge_request" do |
| 92 | - post api("/projects/#{fork_project.id}/merge_requests", user2), | 93 | + post api("/projects/#{fork_project.to_param}/merge_requests", user2), |
| 93 | title: 'Test merge_request', source_branch: "stable", target_branch: "master", author: user2, target_project_id: project.id | 94 | title: 'Test merge_request', source_branch: "stable", target_branch: "master", author: user2, target_project_id: project.id |
| 94 | response.status.should == 201 | 95 | response.status.should == 201 |
| 95 | json_response['title'].should == 'Test merge_request' | 96 | json_response['title'].should == 'Test merge_request' |
| 96 | end | 97 | end |
| 97 | 98 | ||
| 98 | it "should not return 422 when source_branch equals target_branch" do | 99 | it "should not return 422 when source_branch equals target_branch" do |
| 99 | - project.id.should_not == fork_project.id | 100 | + project.to_param.should_not == fork_project.to_param |
| 100 | fork_project.forked?.should be_true | 101 | fork_project.forked?.should be_true |
| 101 | fork_project.forked_from_project.should == project | 102 | fork_project.forked_from_project.should == project |
| 102 | - post api("/projects/#{fork_project.id}/merge_requests", user2), | 103 | + post api("/projects/#{fork_project.to_param}/merge_requests", user2), |
| 103 | title: 'Test merge_request', source_branch: "master", target_branch: "master", author: user2, target_project_id: project.id | 104 | title: 'Test merge_request', source_branch: "master", target_branch: "master", author: user2, target_project_id: project.id |
| 104 | response.status.should == 201 | 105 | response.status.should == 201 |
| 105 | json_response['title'].should == 'Test merge_request' | 106 | json_response['title'].should == 'Test merge_request' |
| 106 | end | 107 | end |
| 107 | 108 | ||
| 108 | it "should return 400 when source_branch is missing" do | 109 | it "should return 400 when source_branch is missing" do |
| 109 | - post api("/projects/#{fork_project.id}/merge_requests", user2), | 110 | + post api("/projects/#{fork_project.to_param}/merge_requests", user2), |
| 110 | title: 'Test merge_request', target_branch: "master", author: user2, target_project_id: project.id | 111 | title: 'Test merge_request', target_branch: "master", author: user2, target_project_id: project.id |
| 111 | response.status.should == 400 | 112 | response.status.should == 400 |
| 112 | end | 113 | end |
| 113 | 114 | ||
| 114 | it "should return 400 when target_branch is missing" do | 115 | it "should return 400 when target_branch is missing" do |
| 115 | - post api("/projects/#{fork_project.id}/merge_requests", user2), | 116 | + post api("/projects/#{fork_project.to_param}/merge_requests", user2), |
| 116 | title: 'Test merge_request', target_branch: "master", author: user2, target_project_id: project.id | 117 | title: 'Test merge_request', target_branch: "master", author: user2, target_project_id: project.id |
| 117 | response.status.should == 400 | 118 | response.status.should == 400 |
| 118 | end | 119 | end |
| 119 | 120 | ||
| 120 | it "should return 400 when title is missing" do | 121 | it "should return 400 when title is missing" do |
| 121 | - post api("/projects/#{fork_project.id}/merge_requests", user2), | 122 | + post api("/projects/#{fork_project.to_param}/merge_requests", user2), |
| 122 | target_branch: 'master', source_branch: 'stable', author: user2, target_project_id: project.id | 123 | target_branch: 'master', source_branch: 'stable', author: user2, target_project_id: project.id |
| 123 | response.status.should == 400 | 124 | response.status.should == 400 |
| 124 | end | 125 | end |
| 125 | 126 | ||
| 126 | it "should return 400 when target_branch is specified and not a forked project" do | 127 | it "should return 400 when target_branch is specified and not a forked project" do |
| 127 | - post api("/projects/#{project.id}/merge_requests", user), | 128 | + post api("/projects/#{project.to_param}/merge_requests", user), |
| 128 | title: 'Test merge_request', target_branch: 'master', source_branch: 'stable', author: user, target_project_id: fork_project.id | 129 | title: 'Test merge_request', target_branch: 'master', source_branch: 'stable', author: user, target_project_id: fork_project.id |
| 129 | response.status.should == 400 | 130 | response.status.should == 400 |
| 130 | end | 131 | end |
| 131 | 132 | ||
| 132 | it "should return 400 when target_branch is specified and for a different fork" do | 133 | it "should return 400 when target_branch is specified and for a different fork" do |
| 133 | - post api("/projects/#{fork_project.id}/merge_requests", user2), | 134 | + post api("/projects/#{fork_project.to_param}/merge_requests", user2), |
| 134 | title: 'Test merge_request', target_branch: 'master', source_branch: 'stable', author: user2, target_project_id: unrelated_project.id | 135 | title: 'Test merge_request', target_branch: 'master', source_branch: 'stable', author: user2, target_project_id: unrelated_project.id |
| 135 | response.status.should == 400 | 136 | response.status.should == 400 |
| 136 | end | 137 | end |
| 137 | 138 | ||
| 138 | it "should return 201 when target_branch is specified and for the same project" do | 139 | it "should return 201 when target_branch is specified and for the same project" do |
| 139 | - post api("/projects/#{fork_project.id}/merge_requests", user2), | 140 | + post api("/projects/#{fork_project.to_param}/merge_requests", user2), |
| 140 | title: 'Test merge_request', target_branch: 'master', source_branch: 'stable', author: user2, target_project_id: fork_project.id | 141 | title: 'Test merge_request', target_branch: 'master', source_branch: 'stable', author: user2, target_project_id: fork_project.id |
| 141 | response.status.should == 201 | 142 | response.status.should == 201 |
| 142 | end | 143 | end |
| @@ -145,7 +146,7 @@ describe API::API do | @@ -145,7 +146,7 @@ describe API::API do | ||
| 145 | 146 | ||
| 146 | describe "PUT /projects/:id/merge_request/:merge_request_id to close MR" do | 147 | describe "PUT /projects/:id/merge_request/:merge_request_id to close MR" do |
| 147 | it "should return merge_request" do | 148 | it "should return merge_request" do |
| 148 | - put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), state_event: "close" | 149 | + put api("/projects/#{project.to_param}/merge_request/#{merge_request.id}", user), state_event: "close" |
| 149 | response.status.should == 200 | 150 | response.status.should == 200 |
| 150 | json_response['state'].should == 'closed' | 151 | json_response['state'].should == 'closed' |
| 151 | end | 152 | end |
| @@ -153,7 +154,7 @@ describe API::API do | @@ -153,7 +154,7 @@ describe API::API do | ||
| 153 | 154 | ||
| 154 | describe "PUT /projects/:id/merge_request/:merge_request_id to merge MR" do | 155 | describe "PUT /projects/:id/merge_request/:merge_request_id to merge MR" do |
| 155 | it "should return merge_request" do | 156 | it "should return merge_request" do |
| 156 | - put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), state_event: "merge" | 157 | + put api("/projects/#{project.to_param}/merge_request/#{merge_request.id}", user), state_event: "merge" |
| 157 | response.status.should == 200 | 158 | response.status.should == 200 |
| 158 | json_response['state'].should == 'merged' | 159 | json_response['state'].should == 'merged' |
| 159 | end | 160 | end |
| @@ -161,19 +162,19 @@ describe API::API do | @@ -161,19 +162,19 @@ describe API::API do | ||
| 161 | 162 | ||
| 162 | describe "PUT /projects/:id/merge_request/:merge_request_id" do | 163 | describe "PUT /projects/:id/merge_request/:merge_request_id" do |
| 163 | it "should return merge_request" do | 164 | it "should return merge_request" do |
| 164 | - put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), title: "New title" | 165 | + put api("/projects/#{project.to_param}/merge_request/#{merge_request.id}", user), title: "New title" |
| 165 | response.status.should == 200 | 166 | response.status.should == 200 |
| 166 | json_response['title'].should == 'New title' | 167 | json_response['title'].should == 'New title' |
| 167 | end | 168 | end |
| 168 | 169 | ||
| 169 | it "should return 422 when source_branch and target_branch are renamed the same" do | 170 | it "should return 422 when source_branch and target_branch are renamed the same" do |
| 170 | - put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), | 171 | + put api("/projects/#{project.to_param}/merge_request/#{merge_request.id}", user), |
| 171 | source_branch: "master", target_branch: "master" | 172 | source_branch: "master", target_branch: "master" |
| 172 | response.status.should == 422 | 173 | response.status.should == 422 |
| 173 | end | 174 | end |
| 174 | 175 | ||
| 175 | it "should return merge_request with renamed target_branch" do | 176 | it "should return merge_request with renamed target_branch" do |
| 176 | - put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), target_branch: "wiki" | 177 | + put api("/projects/#{project.to_param}/merge_request/#{merge_request.id}", user), target_branch: "wiki" |
| 177 | response.status.should == 200 | 178 | response.status.should == 200 |
| 178 | json_response['target_branch'].should == 'wiki' | 179 | json_response['target_branch'].should == 'wiki' |
| 179 | end | 180 | end |
| @@ -181,18 +182,18 @@ describe API::API do | @@ -181,18 +182,18 @@ describe API::API do | ||
| 181 | 182 | ||
| 182 | describe "POST /projects/:id/merge_request/:merge_request_id/comments" do | 183 | describe "POST /projects/:id/merge_request/:merge_request_id/comments" do |
| 183 | it "should return comment" do | 184 | it "should return comment" do |
| 184 | - post api("/projects/#{project.id}/merge_request/#{merge_request.id}/comments", user), note: "My comment" | 185 | + post api("/projects/#{project.to_param}/merge_request/#{merge_request.id}/comments", user), note: "My comment" |
| 185 | response.status.should == 201 | 186 | response.status.should == 201 |
| 186 | json_response['note'].should == 'My comment' | 187 | json_response['note'].should == 'My comment' |
| 187 | end | 188 | end |
| 188 | 189 | ||
| 189 | it "should return 400 if note is missing" do | 190 | it "should return 400 if note is missing" do |
| 190 | - post api("/projects/#{project.id}/merge_request/#{merge_request.id}/comments", user) | 191 | + post api("/projects/#{project.to_param}/merge_request/#{merge_request.id}/comments", user) |
| 191 | response.status.should == 400 | 192 | response.status.should == 400 |
| 192 | end | 193 | end |
| 193 | 194 | ||
| 194 | it "should return 404 if note is attached to non existent merge request" do | 195 | it "should return 404 if note is attached to non existent merge request" do |
| 195 | - post api("/projects/#{project.id}/merge_request/111/comments", user), note: "My comment" | 196 | + post api("/projects/#{project.to_param}/merge_request/111/comments", user), note: "My comment" |
| 196 | response.status.should == 404 | 197 | response.status.should == 404 |
| 197 | end | 198 | end |
| 198 | end | 199 | end |
spec/routing/project_routing_spec.rb
| @@ -25,31 +25,31 @@ shared_examples "RESTful project resources" do | @@ -25,31 +25,31 @@ shared_examples "RESTful project resources" do | ||
| 25 | let(:actions) { [:index, :create, :new, :edit, :show, :update, :destroy] } | 25 | let(:actions) { [:index, :create, :new, :edit, :show, :update, :destroy] } |
| 26 | 26 | ||
| 27 | it "to #index" do | 27 | it "to #index" do |
| 28 | - get("/gitlabhq/#{controller}").should route_to("projects/#{controller}#index", project_id: 'gitlabhq') if actions.include?(:index) | 28 | + get("/gitlab/gitlabhq/#{controller}").should route_to("projects/#{controller}#index", project_id: 'gitlab/gitlabhq') if actions.include?(:index) |
| 29 | end | 29 | end |
| 30 | 30 | ||
| 31 | it "to #create" do | 31 | it "to #create" do |
| 32 | - post("/gitlabhq/#{controller}").should route_to("projects/#{controller}#create", project_id: 'gitlabhq') if actions.include?(:create) | 32 | + post("/gitlab/gitlabhq/#{controller}").should route_to("projects/#{controller}#create", project_id: 'gitlab/gitlabhq') if actions.include?(:create) |
| 33 | end | 33 | end |
| 34 | 34 | ||
| 35 | it "to #new" do | 35 | it "to #new" do |
| 36 | - get("/gitlabhq/#{controller}/new").should route_to("projects/#{controller}#new", project_id: 'gitlabhq') if actions.include?(:new) | 36 | + get("/gitlab/gitlabhq/#{controller}/new").should route_to("projects/#{controller}#new", project_id: 'gitlab/gitlabhq') if actions.include?(:new) |
| 37 | end | 37 | end |
| 38 | 38 | ||
| 39 | it "to #edit" do | 39 | it "to #edit" do |
| 40 | - get("/gitlabhq/#{controller}/1/edit").should route_to("projects/#{controller}#edit", project_id: 'gitlabhq', id: '1') if actions.include?(:edit) | 40 | + get("/gitlab/gitlabhq/#{controller}/1/edit").should route_to("projects/#{controller}#edit", project_id: 'gitlab/gitlabhq', id: '1') if actions.include?(:edit) |
| 41 | end | 41 | end |
| 42 | 42 | ||
| 43 | it "to #show" do | 43 | it "to #show" do |
| 44 | - get("/gitlabhq/#{controller}/1").should route_to("projects/#{controller}#show", project_id: 'gitlabhq', id: '1') if actions.include?(:show) | 44 | + get("/gitlab/gitlabhq/#{controller}/1").should route_to("projects/#{controller}#show", project_id: 'gitlab/gitlabhq', id: '1') if actions.include?(:show) |
| 45 | end | 45 | end |
| 46 | 46 | ||
| 47 | it "to #update" do | 47 | it "to #update" do |
| 48 | - put("/gitlabhq/#{controller}/1").should route_to("projects/#{controller}#update", project_id: 'gitlabhq', id: '1') if actions.include?(:update) | 48 | + put("/gitlab/gitlabhq/#{controller}/1").should route_to("projects/#{controller}#update", project_id: 'gitlab/gitlabhq', id: '1') if actions.include?(:update) |
| 49 | end | 49 | end |
| 50 | 50 | ||
| 51 | it "to #destroy" do | 51 | it "to #destroy" do |
| 52 | - delete("/gitlabhq/#{controller}/1").should route_to("projects/#{controller}#destroy", project_id: 'gitlabhq', id: '1') if actions.include?(:destroy) | 52 | + delete("/gitlab/gitlabhq/#{controller}/1").should route_to("projects/#{controller}#destroy", project_id: 'gitlab/gitlabhq', id: '1') if actions.include?(:destroy) |
| 53 | end | 53 | end |
| 54 | end | 54 | end |
| 55 | 55 | ||
| @@ -72,31 +72,31 @@ describe ProjectsController, "routing" do | @@ -72,31 +72,31 @@ describe ProjectsController, "routing" do | ||
| 72 | end | 72 | end |
| 73 | 73 | ||
| 74 | it "to #fork" do | 74 | it "to #fork" do |
| 75 | - post("/gitlabhq/fork").should route_to('projects#fork', id: 'gitlabhq') | 75 | + post("/gitlab/gitlabhq/fork").should route_to('projects#fork', id: 'gitlab/gitlabhq') |
| 76 | end | 76 | end |
| 77 | 77 | ||
| 78 | it "to #wall" do | 78 | it "to #wall" do |
| 79 | - get("/gitlabhq/wall").should route_to('projects/walls#show', project_id: 'gitlabhq') | 79 | + get("/gitlab/gitlabhq/wall").should route_to('projects/walls#show', project_id: 'gitlab/gitlabhq') |
| 80 | end | 80 | end |
| 81 | 81 | ||
| 82 | it "to #edit" do | 82 | it "to #edit" do |
| 83 | - get("/gitlabhq/edit").should route_to('projects#edit', id: 'gitlabhq') | 83 | + get("/gitlab/gitlabhq/edit").should route_to('projects#edit', id: 'gitlab/gitlabhq') |
| 84 | end | 84 | end |
| 85 | 85 | ||
| 86 | it "to #autocomplete_sources" do | 86 | it "to #autocomplete_sources" do |
| 87 | - get('/gitlabhq/autocomplete_sources').should route_to('projects#autocomplete_sources', id: "gitlabhq") | 87 | + get('/gitlab/gitlabhq/autocomplete_sources').should route_to('projects#autocomplete_sources', id: "gitlab/gitlabhq") |
| 88 | end | 88 | end |
| 89 | 89 | ||
| 90 | it "to #show" do | 90 | it "to #show" do |
| 91 | - get("/gitlabhq").should route_to('projects#show', id: 'gitlabhq') | 91 | + get("/gitlab/gitlabhq").should route_to('projects#show', id: 'gitlab/gitlabhq') |
| 92 | end | 92 | end |
| 93 | 93 | ||
| 94 | it "to #update" do | 94 | it "to #update" do |
| 95 | - put("/gitlabhq").should route_to('projects#update', id: 'gitlabhq') | 95 | + put("/gitlab/gitlabhq").should route_to('projects#update', id: 'gitlab/gitlabhq') |
| 96 | end | 96 | end |
| 97 | 97 | ||
| 98 | it "to #destroy" do | 98 | it "to #destroy" do |
| 99 | - delete("/gitlabhq").should route_to('projects#destroy', id: 'gitlabhq') | 99 | + delete("/gitlab/gitlabhq").should route_to('projects#destroy', id: 'gitlab/gitlabhq') |
| 100 | end | 100 | end |
| 101 | end | 101 | end |
| 102 | 102 | ||
| @@ -108,11 +108,11 @@ end | @@ -108,11 +108,11 @@ end | ||
| 108 | # DELETE /:project_id/wikis/:id(.:format) projects/wikis#destroy | 108 | # DELETE /:project_id/wikis/:id(.:format) projects/wikis#destroy |
| 109 | describe Projects::WikisController, "routing" do | 109 | describe Projects::WikisController, "routing" do |
| 110 | it "to #pages" do | 110 | it "to #pages" do |
| 111 | - get("/gitlabhq/wikis/pages").should route_to('projects/wikis#pages', project_id: 'gitlabhq') | 111 | + get("/gitlab/gitlabhq/wikis/pages").should route_to('projects/wikis#pages', project_id: 'gitlab/gitlabhq') |
| 112 | end | 112 | end |
| 113 | 113 | ||
| 114 | it "to #history" do | 114 | it "to #history" do |
| 115 | - get("/gitlabhq/wikis/1/history").should route_to('projects/wikis#history', project_id: 'gitlabhq', id: '1') | 115 | + get("/gitlab/gitlabhq/wikis/1/history").should route_to('projects/wikis#history', project_id: 'gitlab/gitlabhq', id: '1') |
| 116 | end | 116 | end |
| 117 | 117 | ||
| 118 | it_behaves_like "RESTful project resources" do | 118 | it_behaves_like "RESTful project resources" do |
| @@ -127,23 +127,23 @@ end | @@ -127,23 +127,23 @@ end | ||
| 127 | # edit_project_repository GET /:project_id/repository/edit(.:format) projects/repositories#edit | 127 | # edit_project_repository GET /:project_id/repository/edit(.:format) projects/repositories#edit |
| 128 | describe Projects::RepositoriesController, "routing" do | 128 | describe Projects::RepositoriesController, "routing" do |
| 129 | it "to #archive" do | 129 | it "to #archive" do |
| 130 | - get("/gitlabhq/repository/archive").should route_to('projects/repositories#archive', project_id: 'gitlabhq') | 130 | + get("/gitlab/gitlabhq/repository/archive").should route_to('projects/repositories#archive', project_id: 'gitlab/gitlabhq') |
| 131 | end | 131 | end |
| 132 | 132 | ||
| 133 | it "to #show" do | 133 | it "to #show" do |
| 134 | - get("/gitlabhq/repository").should route_to('projects/repositories#show', project_id: 'gitlabhq') | 134 | + get("/gitlab/gitlabhq/repository").should route_to('projects/repositories#show', project_id: 'gitlab/gitlabhq') |
| 135 | end | 135 | end |
| 136 | end | 136 | end |
| 137 | 137 | ||
| 138 | describe Projects::BranchesController, "routing" do | 138 | describe Projects::BranchesController, "routing" do |
| 139 | it "to #branches" do | 139 | it "to #branches" do |
| 140 | - get("/gitlabhq/branches").should route_to('projects/branches#index', project_id: 'gitlabhq') | 140 | + get("/gitlab/gitlabhq/branches").should route_to('projects/branches#index', project_id: 'gitlab/gitlabhq') |
| 141 | end | 141 | end |
| 142 | end | 142 | end |
| 143 | 143 | ||
| 144 | describe Projects::TagsController, "routing" do | 144 | describe Projects::TagsController, "routing" do |
| 145 | it "to #tags" do | 145 | it "to #tags" do |
| 146 | - get("/gitlabhq/tags").should route_to('projects/tags#index', project_id: 'gitlabhq') | 146 | + get("/gitlab/gitlabhq/tags").should route_to('projects/tags#index', project_id: 'gitlab/gitlabhq') |
| 147 | end | 147 | end |
| 148 | end | 148 | end |
| 149 | 149 | ||
| @@ -176,16 +176,16 @@ end | @@ -176,16 +176,16 @@ end | ||
| 176 | # logs_file_project_ref GET /:project_id/refs/:id/logs_tree/:path(.:format) refs#logs_tree | 176 | # logs_file_project_ref GET /:project_id/refs/:id/logs_tree/:path(.:format) refs#logs_tree |
| 177 | describe Projects::RefsController, "routing" do | 177 | describe Projects::RefsController, "routing" do |
| 178 | it "to #switch" do | 178 | it "to #switch" do |
| 179 | - get("/gitlabhq/refs/switch").should route_to('projects/refs#switch', project_id: 'gitlabhq') | 179 | + get("/gitlab/gitlabhq/refs/switch").should route_to('projects/refs#switch', project_id: 'gitlab/gitlabhq') |
| 180 | end | 180 | end |
| 181 | 181 | ||
| 182 | it "to #logs_tree" do | 182 | it "to #logs_tree" do |
| 183 | - get("/gitlabhq/refs/stable/logs_tree").should route_to('projects/refs#logs_tree', project_id: 'gitlabhq', id: 'stable') | ||
| 184 | - get("/gitlabhq/refs/feature%2345/logs_tree").should route_to('projects/refs#logs_tree', project_id: 'gitlabhq', id: 'feature#45') | ||
| 185 | - get("/gitlabhq/refs/feature%2B45/logs_tree").should route_to('projects/refs#logs_tree', project_id: 'gitlabhq', id: 'feature+45') | ||
| 186 | - 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') | ||
| 187 | - 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') | ||
| 188 | - 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') | 183 | + get("/gitlab/gitlabhq/refs/stable/logs_tree").should route_to('projects/refs#logs_tree', project_id: 'gitlab/gitlabhq', id: 'stable') |
| 184 | + get("/gitlab/gitlabhq/refs/feature%2345/logs_tree").should route_to('projects/refs#logs_tree', project_id: 'gitlab/gitlabhq', id: 'feature#45') | ||
| 185 | + get("/gitlab/gitlabhq/refs/feature%2B45/logs_tree").should route_to('projects/refs#logs_tree', project_id: 'gitlab/gitlabhq', id: 'feature+45') | ||
| 186 | + get("/gitlab/gitlabhq/refs/stable/logs_tree/foo/bar/baz").should route_to('projects/refs#logs_tree', project_id: 'gitlab/gitlabhq', id: 'stable', path: 'foo/bar/baz') | ||
| 187 | + get("/gitlab/gitlabhq/refs/feature%2345/logs_tree/foo/bar/baz").should route_to('projects/refs#logs_tree', project_id: 'gitlab/gitlabhq', id: 'feature#45', path: 'foo/bar/baz') | ||
| 188 | + get("/gitlab/gitlabhq/refs/feature%2B45/logs_tree/foo/bar/baz").should route_to('projects/refs#logs_tree', project_id: 'gitlab/gitlabhq', id: 'feature+45', path: 'foo/bar/baz') | ||
| 189 | 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') | 189 | 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') |
| 190 | end | 190 | end |
| 191 | end | 191 | end |
| @@ -204,28 +204,28 @@ end | @@ -204,28 +204,28 @@ end | ||
| 204 | # DELETE /:project_id/merge_requests/:id(.:format) projects/merge_requests#destroy | 204 | # DELETE /:project_id/merge_requests/:id(.:format) projects/merge_requests#destroy |
| 205 | describe Projects::MergeRequestsController, "routing" do | 205 | describe Projects::MergeRequestsController, "routing" do |
| 206 | it "to #diffs" do | 206 | it "to #diffs" do |
| 207 | - get("/gitlabhq/merge_requests/1/diffs").should route_to('projects/merge_requests#diffs', project_id: 'gitlabhq', id: '1') | 207 | + get("/gitlab/gitlabhq/merge_requests/1/diffs").should route_to('projects/merge_requests#diffs', project_id: 'gitlab/gitlabhq', id: '1') |
| 208 | end | 208 | end |
| 209 | 209 | ||
| 210 | it "to #automerge" do | 210 | it "to #automerge" do |
| 211 | - get("/gitlabhq/merge_requests/1/automerge").should route_to('projects/merge_requests#automerge', project_id: 'gitlabhq', id: '1') | 211 | + get("/gitlab/gitlabhq/merge_requests/1/automerge").should route_to('projects/merge_requests#automerge', project_id: 'gitlab/gitlabhq', id: '1') |
| 212 | end | 212 | end |
| 213 | 213 | ||
| 214 | it "to #automerge_check" do | 214 | it "to #automerge_check" do |
| 215 | - get("/gitlabhq/merge_requests/1/automerge_check").should route_to('projects/merge_requests#automerge_check', project_id: 'gitlabhq', id: '1') | 215 | + get("/gitlab/gitlabhq/merge_requests/1/automerge_check").should route_to('projects/merge_requests#automerge_check', project_id: 'gitlab/gitlabhq', id: '1') |
| 216 | end | 216 | end |
| 217 | 217 | ||
| 218 | it "to #branch_from" do | 218 | it "to #branch_from" do |
| 219 | - get("/gitlabhq/merge_requests/branch_from").should route_to('projects/merge_requests#branch_from', project_id: 'gitlabhq') | 219 | + get("/gitlab/gitlabhq/merge_requests/branch_from").should route_to('projects/merge_requests#branch_from', project_id: 'gitlab/gitlabhq') |
| 220 | end | 220 | end |
| 221 | 221 | ||
| 222 | it "to #branch_to" do | 222 | it "to #branch_to" do |
| 223 | - get("/gitlabhq/merge_requests/branch_to").should route_to('projects/merge_requests#branch_to', project_id: 'gitlabhq') | 223 | + get("/gitlab/gitlabhq/merge_requests/branch_to").should route_to('projects/merge_requests#branch_to', project_id: 'gitlab/gitlabhq') |
| 224 | end | 224 | end |
| 225 | 225 | ||
| 226 | it "to #show" do | 226 | it "to #show" do |
| 227 | - get("/gitlabhq/merge_requests/1.diff").should route_to('projects/merge_requests#show', project_id: 'gitlabhq', id: '1', format: 'diff') | ||
| 228 | - get("/gitlabhq/merge_requests/1.patch").should route_to('projects/merge_requests#show', project_id: 'gitlabhq', id: '1', format: 'patch') | 227 | + get("/gitlab/gitlabhq/merge_requests/1.diff").should route_to('projects/merge_requests#show', project_id: 'gitlab/gitlabhq', id: '1', format: 'diff') |
| 228 | + get("/gitlab/gitlabhq/merge_requests/1.patch").should route_to('projects/merge_requests#show', project_id: 'gitlab/gitlabhq', id: '1', format: 'patch') | ||
| 229 | end | 229 | end |
| 230 | 230 | ||
| 231 | it_behaves_like "RESTful project resources" do | 231 | it_behaves_like "RESTful project resources" do |
| @@ -244,35 +244,35 @@ end | @@ -244,35 +244,35 @@ end | ||
| 244 | # DELETE /:project_id/snippets/:id(.:format) snippets#destroy | 244 | # DELETE /:project_id/snippets/:id(.:format) snippets#destroy |
| 245 | describe SnippetsController, "routing" do | 245 | describe SnippetsController, "routing" do |
| 246 | it "to #raw" do | 246 | it "to #raw" do |
| 247 | - get("/gitlabhq/snippets/1/raw").should route_to('projects/snippets#raw', project_id: 'gitlabhq', id: '1') | 247 | + get("/gitlab/gitlabhq/snippets/1/raw").should route_to('projects/snippets#raw', project_id: 'gitlab/gitlabhq', id: '1') |
| 248 | end | 248 | end |
| 249 | 249 | ||
| 250 | it "to #index" do | 250 | it "to #index" do |
| 251 | - get("/gitlabhq/snippets").should route_to("projects/snippets#index", project_id: 'gitlabhq') | 251 | + get("/gitlab/gitlabhq/snippets").should route_to("projects/snippets#index", project_id: 'gitlab/gitlabhq') |
| 252 | end | 252 | end |
| 253 | 253 | ||
| 254 | it "to #create" do | 254 | it "to #create" do |
| 255 | - post("/gitlabhq/snippets").should route_to("projects/snippets#create", project_id: 'gitlabhq') | 255 | + post("/gitlab/gitlabhq/snippets").should route_to("projects/snippets#create", project_id: 'gitlab/gitlabhq') |
| 256 | end | 256 | end |
| 257 | 257 | ||
| 258 | it "to #new" do | 258 | it "to #new" do |
| 259 | - get("/gitlabhq/snippets/new").should route_to("projects/snippets#new", project_id: 'gitlabhq') | 259 | + get("/gitlab/gitlabhq/snippets/new").should route_to("projects/snippets#new", project_id: 'gitlab/gitlabhq') |
| 260 | end | 260 | end |
| 261 | 261 | ||
| 262 | it "to #edit" do | 262 | it "to #edit" do |
| 263 | - get("/gitlabhq/snippets/1/edit").should route_to("projects/snippets#edit", project_id: 'gitlabhq', id: '1') | 263 | + get("/gitlab/gitlabhq/snippets/1/edit").should route_to("projects/snippets#edit", project_id: 'gitlab/gitlabhq', id: '1') |
| 264 | end | 264 | end |
| 265 | 265 | ||
| 266 | it "to #show" do | 266 | it "to #show" do |
| 267 | - get("/gitlabhq/snippets/1").should route_to("projects/snippets#show", project_id: 'gitlabhq', id: '1') | 267 | + get("/gitlab/gitlabhq/snippets/1").should route_to("projects/snippets#show", project_id: 'gitlab/gitlabhq', id: '1') |
| 268 | end | 268 | end |
| 269 | 269 | ||
| 270 | it "to #update" do | 270 | it "to #update" do |
| 271 | - put("/gitlabhq/snippets/1").should route_to("projects/snippets#update", project_id: 'gitlabhq', id: '1') | 271 | + put("/gitlab/gitlabhq/snippets/1").should route_to("projects/snippets#update", project_id: 'gitlab/gitlabhq', id: '1') |
| 272 | end | 272 | end |
| 273 | 273 | ||
| 274 | it "to #destroy" do | 274 | it "to #destroy" do |
| 275 | - delete("/gitlabhq/snippets/1").should route_to("projects/snippets#destroy", project_id: 'gitlabhq', id: '1') | 275 | + delete("/gitlab/gitlabhq/snippets/1").should route_to("projects/snippets#destroy", project_id: 'gitlab/gitlabhq', id: '1') |
| 276 | end | 276 | end |
| 277 | end | 277 | end |
| 278 | 278 | ||
| @@ -282,7 +282,7 @@ end | @@ -282,7 +282,7 @@ end | ||
| 282 | # project_hook DELETE /:project_id/hooks/:id(.:format) hooks#destroy | 282 | # project_hook DELETE /:project_id/hooks/:id(.:format) hooks#destroy |
| 283 | describe Projects::HooksController, "routing" do | 283 | describe Projects::HooksController, "routing" do |
| 284 | it "to #test" do | 284 | it "to #test" do |
| 285 | - get("/gitlabhq/hooks/1/test").should route_to('projects/hooks#test', project_id: 'gitlabhq', id: '1') | 285 | + get("/gitlab/gitlabhq/hooks/1/test").should route_to('projects/hooks#test', project_id: 'gitlab/gitlabhq', id: '1') |
| 286 | end | 286 | end |
| 287 | 287 | ||
| 288 | it_behaves_like "RESTful project resources" do | 288 | it_behaves_like "RESTful project resources" do |
| @@ -294,10 +294,10 @@ end | @@ -294,10 +294,10 @@ end | ||
| 294 | # project_commit GET /:project_id/commit/:id(.:format) commit#show {id: /[[:alnum:]]{6,40}/, project_id: /[^\/]+/} | 294 | # project_commit GET /:project_id/commit/:id(.:format) commit#show {id: /[[:alnum:]]{6,40}/, project_id: /[^\/]+/} |
| 295 | describe Projects::CommitController, "routing" do | 295 | describe Projects::CommitController, "routing" do |
| 296 | it "to #show" do | 296 | it "to #show" do |
| 297 | - get("/gitlabhq/commit/4246fb").should route_to('projects/commit#show', project_id: 'gitlabhq', id: '4246fb') | ||
| 298 | - get("/gitlabhq/commit/4246fb.diff").should route_to('projects/commit#show', project_id: 'gitlabhq', id: '4246fb', format: 'diff') | ||
| 299 | - get("/gitlabhq/commit/4246fb.patch").should route_to('projects/commit#show', project_id: 'gitlabhq', id: '4246fb', format: 'patch') | ||
| 300 | - get("/gitlabhq/commit/4246fbd13872934f72a8fd0d6fb1317b47b59cb5").should route_to('projects/commit#show', project_id: 'gitlabhq', id: '4246fbd13872934f72a8fd0d6fb1317b47b59cb5') | 297 | + get("/gitlab/gitlabhq/commit/4246fb").should route_to('projects/commit#show', project_id: 'gitlab/gitlabhq', id: '4246fb') |
| 298 | + get("/gitlab/gitlabhq/commit/4246fb.diff").should route_to('projects/commit#show', project_id: 'gitlab/gitlabhq', id: '4246fb', format: 'diff') | ||
| 299 | + get("/gitlab/gitlabhq/commit/4246fb.patch").should route_to('projects/commit#show', project_id: 'gitlab/gitlabhq', id: '4246fb', format: 'patch') | ||
| 300 | + get("/gitlab/gitlabhq/commit/4246fbd13872934f72a8fd0d6fb1317b47b59cb5").should route_to('projects/commit#show', project_id: 'gitlab/gitlabhq', id: '4246fbd13872934f72a8fd0d6fb1317b47b59cb5') | ||
| 301 | end | 301 | end |
| 302 | end | 302 | end |
| 303 | 303 | ||
| @@ -347,7 +347,7 @@ end | @@ -347,7 +347,7 @@ end | ||
| 347 | # project_labels GET /:project_id/labels(.:format) labels#index | 347 | # project_labels GET /:project_id/labels(.:format) labels#index |
| 348 | describe Projects::LabelsController, "routing" do | 348 | describe Projects::LabelsController, "routing" do |
| 349 | it "to #index" do | 349 | it "to #index" do |
| 350 | - get("/gitlabhq/labels").should route_to('projects/labels#index', project_id: 'gitlabhq') | 350 | + get("/gitlab/gitlabhq/labels").should route_to('projects/labels#index', project_id: 'gitlab/gitlabhq') |
| 351 | end | 351 | end |
| 352 | end | 352 | end |
| 353 | 353 | ||
| @@ -363,7 +363,7 @@ end | @@ -363,7 +363,7 @@ end | ||
| 363 | # DELETE /:project_id/issues/:id(.:format) issues#destroy | 363 | # DELETE /:project_id/issues/:id(.:format) issues#destroy |
| 364 | describe Projects::IssuesController, "routing" do | 364 | describe Projects::IssuesController, "routing" do |
| 365 | it "to #bulk_update" do | 365 | it "to #bulk_update" do |
| 366 | - post("/gitlabhq/issues/bulk_update").should route_to('projects/issues#bulk_update', project_id: 'gitlabhq') | 366 | + post("/gitlab/gitlabhq/issues/bulk_update").should route_to('projects/issues#bulk_update', project_id: 'gitlab/gitlabhq') |
| 367 | end | 367 | end |
| 368 | 368 | ||
| 369 | it_behaves_like "RESTful project resources" do | 369 | it_behaves_like "RESTful project resources" do |
| @@ -378,7 +378,7 @@ end | @@ -378,7 +378,7 @@ end | ||
| 378 | # project_note DELETE /:project_id/notes/:id(.:format) notes#destroy | 378 | # project_note DELETE /:project_id/notes/:id(.:format) notes#destroy |
| 379 | describe Projects::NotesController, "routing" do | 379 | describe Projects::NotesController, "routing" do |
| 380 | it "to #preview" do | 380 | it "to #preview" do |
| 381 | - post("/gitlabhq/notes/preview").should route_to('projects/notes#preview', project_id: 'gitlabhq') | 381 | + post("/gitlab/gitlabhq/notes/preview").should route_to('projects/notes#preview', project_id: 'gitlab/gitlabhq') |
| 382 | end | 382 | end |
| 383 | 383 | ||
| 384 | it_behaves_like "RESTful project resources" do | 384 | it_behaves_like "RESTful project resources" do |
| @@ -390,7 +390,7 @@ end | @@ -390,7 +390,7 @@ end | ||
| 390 | # project_blame GET /:project_id/blame/:id(.:format) blame#show {id: /.+/, project_id: /[^\/]+/} | 390 | # project_blame GET /:project_id/blame/:id(.:format) blame#show {id: /.+/, project_id: /[^\/]+/} |
| 391 | describe Projects::BlameController, "routing" do | 391 | describe Projects::BlameController, "routing" do |
| 392 | it "to #show" do | 392 | it "to #show" do |
| 393 | - get("/gitlabhq/blame/master/app/models/project.rb").should route_to('projects/blame#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') | 393 | + get("/gitlab/gitlabhq/blame/master/app/models/project.rb").should route_to('projects/blame#show', project_id: 'gitlab/gitlabhq', id: 'master/app/models/project.rb') |
| 394 | get("/gitlab/gitlabhq/blame/master/files.scss").should route_to('projects/blame#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') | 394 | get("/gitlab/gitlabhq/blame/master/files.scss").should route_to('projects/blame#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') |
| 395 | end | 395 | end |
| 396 | end | 396 | end |
| @@ -398,8 +398,8 @@ end | @@ -398,8 +398,8 @@ end | ||
| 398 | # project_blob GET /:project_id/blob/:id(.:format) blob#show {id: /.+/, project_id: /[^\/]+/} | 398 | # project_blob GET /:project_id/blob/:id(.:format) blob#show {id: /.+/, project_id: /[^\/]+/} |
| 399 | describe Projects::BlobController, "routing" do | 399 | describe Projects::BlobController, "routing" do |
| 400 | it "to #show" do | 400 | it "to #show" do |
| 401 | - get("/gitlabhq/blob/master/app/models/project.rb").should route_to('projects/blob#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') | ||
| 402 | - get("/gitlabhq/blob/master/app/models/compare.rb").should route_to('projects/blob#show', project_id: 'gitlabhq', id: 'master/app/models/compare.rb') | 401 | + get("/gitlab/gitlabhq/blob/master/app/models/project.rb").should route_to('projects/blob#show', project_id: 'gitlab/gitlabhq', id: 'master/app/models/project.rb') |
| 402 | + get("/gitlab/gitlabhq/blob/master/app/models/compare.rb").should route_to('projects/blob#show', project_id: 'gitlab/gitlabhq', id: 'master/app/models/compare.rb') | ||
| 403 | get("/gitlab/gitlabhq/blob/master/files.scss").should route_to('projects/blob#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') | 403 | get("/gitlab/gitlabhq/blob/master/files.scss").should route_to('projects/blob#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') |
| 404 | end | 404 | end |
| 405 | end | 405 | end |
| @@ -407,7 +407,7 @@ end | @@ -407,7 +407,7 @@ end | ||
| 407 | # project_tree GET /:project_id/tree/:id(.:format) tree#show {id: /.+/, project_id: /[^\/]+/} | 407 | # project_tree GET /:project_id/tree/:id(.:format) tree#show {id: /.+/, project_id: /[^\/]+/} |
| 408 | describe Projects::TreeController, "routing" do | 408 | describe Projects::TreeController, "routing" do |
| 409 | it "to #show" do | 409 | it "to #show" do |
| 410 | - get("/gitlabhq/tree/master/app/models/project.rb").should route_to('projects/tree#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') | 410 | + get("/gitlab/gitlabhq/tree/master/app/models/project.rb").should route_to('projects/tree#show', project_id: 'gitlab/gitlabhq', id: 'master/app/models/project.rb') |
| 411 | get("/gitlab/gitlabhq/tree/master/files.scss").should route_to('projects/tree#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') | 411 | get("/gitlab/gitlabhq/tree/master/files.scss").should route_to('projects/tree#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') |
| 412 | end | 412 | end |
| 413 | end | 413 | end |
| @@ -417,28 +417,28 @@ end | @@ -417,28 +417,28 @@ end | ||
| 417 | # project_compare /:project_id/compare/:from...:to(.:format) compare#show {from: /.+/, to: /.+/, id: /[^\/]+/, project_id: /[^\/]+/} | 417 | # project_compare /:project_id/compare/:from...:to(.:format) compare#show {from: /.+/, to: /.+/, id: /[^\/]+/, project_id: /[^\/]+/} |
| 418 | describe Projects::CompareController, "routing" do | 418 | describe Projects::CompareController, "routing" do |
| 419 | it "to #index" do | 419 | it "to #index" do |
| 420 | - get("/gitlabhq/compare").should route_to('projects/compare#index', project_id: 'gitlabhq') | 420 | + get("/gitlab/gitlabhq/compare").should route_to('projects/compare#index', project_id: 'gitlab/gitlabhq') |
| 421 | end | 421 | end |
| 422 | 422 | ||
| 423 | it "to #compare" do | 423 | it "to #compare" do |
| 424 | - post("/gitlabhq/compare").should route_to('projects/compare#create', project_id: 'gitlabhq') | 424 | + post("/gitlab/gitlabhq/compare").should route_to('projects/compare#create', project_id: 'gitlab/gitlabhq') |
| 425 | end | 425 | end |
| 426 | 426 | ||
| 427 | it "to #show" do | 427 | it "to #show" do |
| 428 | - get("/gitlabhq/compare/master...stable").should route_to('projects/compare#show', project_id: 'gitlabhq', from: 'master', to: 'stable') | ||
| 429 | - get("/gitlabhq/compare/issue/1234...stable").should route_to('projects/compare#show', project_id: 'gitlabhq', from: 'issue/1234', to: 'stable') | 428 | + get("/gitlab/gitlabhq/compare/master...stable").should route_to('projects/compare#show', project_id: 'gitlab/gitlabhq', from: 'master', to: 'stable') |
| 429 | + get("/gitlab/gitlabhq/compare/issue/1234...stable").should route_to('projects/compare#show', project_id: 'gitlab/gitlabhq', from: 'issue/1234', to: 'stable') | ||
| 430 | end | 430 | end |
| 431 | end | 431 | end |
| 432 | 432 | ||
| 433 | describe Projects::NetworkController, "routing" do | 433 | describe Projects::NetworkController, "routing" do |
| 434 | it "to #show" do | 434 | it "to #show" do |
| 435 | - get("/gitlabhq/network/master").should route_to('projects/network#show', project_id: 'gitlabhq', id: 'master') | ||
| 436 | - get("/gitlabhq/network/master.json").should route_to('projects/network#show', project_id: 'gitlabhq', id: 'master', format: "json") | 435 | + get("/gitlab/gitlabhq/network/master").should route_to('projects/network#show', project_id: 'gitlab/gitlabhq', id: 'master') |
| 436 | + get("/gitlab/gitlabhq/network/master.json").should route_to('projects/network#show', project_id: 'gitlab/gitlabhq', id: 'master', format: "json") | ||
| 437 | end | 437 | end |
| 438 | end | 438 | end |
| 439 | 439 | ||
| 440 | describe Projects::GraphsController, "routing" do | 440 | describe Projects::GraphsController, "routing" do |
| 441 | it "to #show" do | 441 | it "to #show" do |
| 442 | - get("/gitlabhq/graphs/master").should route_to('projects/graphs#show', project_id: 'gitlabhq', id: 'master') | 442 | + get("/gitlab/gitlabhq/graphs/master").should route_to('projects/graphs#show', project_id: 'gitlab/gitlabhq', id: 'master') |
| 443 | end | 443 | end |
| 444 | end | 444 | end |
spec/routing/routing_spec.rb
| @@ -11,11 +11,11 @@ end | @@ -11,11 +11,11 @@ end | ||
| 11 | # /:path Grack | 11 | # /:path Grack |
| 12 | describe "Mounted Apps", "routing" do | 12 | describe "Mounted Apps", "routing" do |
| 13 | it "to API" do | 13 | it "to API" do |
| 14 | - get("/api").should be_routable | 14 | + get("/api/issues").should be_routable |
| 15 | end | 15 | end |
| 16 | 16 | ||
| 17 | it "to Grack" do | 17 | it "to Grack" do |
| 18 | - get("/gitlabhq.git").should be_routable | 18 | + get("/gitlab/gitlabhq.git").should be_routable |
| 19 | end | 19 | end |
| 20 | end | 20 | end |
| 21 | 21 |
spec/services/git_push_service_spec.rb
| @@ -48,7 +48,7 @@ describe GitPushService do | @@ -48,7 +48,7 @@ describe GitPushService do | ||
| 48 | it { should include(id: @commit.id) } | 48 | it { should include(id: @commit.id) } |
| 49 | it { should include(message: @commit.safe_message) } | 49 | it { should include(message: @commit.safe_message) } |
| 50 | it { should include(timestamp: @commit.date.xmlschema) } | 50 | it { should include(timestamp: @commit.date.xmlschema) } |
| 51 | - it { should include(url: "#{Gitlab.config.gitlab.url}/#{project.code}/commit/#{@commit.id}") } | 51 | + it { should include(url: "#{Gitlab.config.gitlab.url}/#{project.to_param}/commit/#{@commit.id}") } |
| 52 | 52 | ||
| 53 | context "with a author" do | 53 | context "with a author" do |
| 54 | subject { @push_data[:commits].first[:author] } | 54 | subject { @push_data[:commits].first[:author] } |