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