diff options
author | Josh Frye <joshfng@gmail.com> | 2016-01-12 12:05:52 -0500 |
---|---|---|
committer | Josh Frye <joshfng@gmail.com> | 2016-07-11 21:11:32 -0400 |
commit | e47f39b9562768b20cb23f3a8f5cf714b11a2013 (patch) | |
tree | 1221c09a91fa546ae555c11bf18dc090afb062bc /spec | |
parent | 3999b80e4ebbfad46b093b94ea5ca31c0c3705be (diff) | |
download | gitlab-ce-fix-api-project-name-case.tar.gz |
Don't run parameterize on project.path. Fixes #6073fix-api-project-name-case
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/issues/filter_by_milestone_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/hooks/system_hook_spec.rb | 4 | ||||
-rw-r--r-- | spec/requests/api/projects_spec.rb | 31 | ||||
-rw-r--r-- | spec/services/issues/bulk_update_service_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/projects/create_service_spec.rb | 3 |
5 files changed, 22 insertions, 20 deletions
diff --git a/spec/features/issues/filter_by_milestone_spec.rb b/spec/features/issues/filter_by_milestone_spec.rb index 99445185893..d6c060836c5 100644 --- a/spec/features/issues/filter_by_milestone_spec.rb +++ b/spec/features/issues/filter_by_milestone_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' feature 'Issue filtering by Milestone', feature: true do - let(:project) { create(:project, :public) } + let(:project) { create(:project, :public, path: 'foo') } let(:milestone) { create(:milestone, project: project) } scenario 'filters by no Milestone', js: true do diff --git a/spec/models/hooks/system_hook_spec.rb b/spec/models/hooks/system_hook_spec.rb index 4078b9e4ff5..397edd302cb 100644 --- a/spec/models/hooks/system_hook_spec.rb +++ b/spec/models/hooks/system_hook_spec.rb @@ -30,7 +30,7 @@ describe SystemHook, models: true do end it "project_create hook" do - Projects::CreateService.new(user, name: 'empty').execute + Projects::CreateService.new(user, path: 'empty').execute expect(WebMock).to have_requested(:post, system_hook.url).with( body: /project_create/, headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'System Hook' } @@ -48,7 +48,7 @@ describe SystemHook, models: true do it "user_create hook" do create(:user) - + expect(WebMock).to have_requested(:post, system_hook.url).with( body: /user_create/, headers: { 'Content-Type' => 'application/json', 'X-Gitlab-Event' => 'System Hook' } diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 8a52725a893..154bf96a331 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -183,25 +183,25 @@ describe API::API, api: true do context 'maximum number of projects reached' do it 'should not create new project and respond with 403' do allow_any_instance_of(User).to receive(:projects_limit_left).and_return(0) - expect { post api('/projects', user2), name: 'foo' }. + expect { post api('/projects', user2), path: 'foo' }. to change {Project.count}.by(0) expect(response).to have_http_status(403) end end - it 'should create new project without path and return 201' do - expect { post api('/projects', user), name: 'foo' }. + it 'should create new project without name and return 201' do + expect { post api('/projects', user), path: 'foo' }. to change { Project.count }.by(1) expect(response).to have_http_status(201) end it 'should create last project before reaching project limit' do allow_any_instance_of(User).to receive(:projects_limit_left).and_return(1) - post api('/projects', user2), name: 'foo' + post api('/projects', user2), path: 'foo' expect(response).to have_http_status(201) end - it 'should not create new project without name and return 400' do + it 'should not create new project without path and return 400' do expect { post api('/projects', user) }.not_to change { Project.count } expect(response).to have_http_status(400) end @@ -293,9 +293,9 @@ describe API::API, api: true do before { project } before { admin } - it 'should create new project without path and return 201' do - expect { post api("/projects/user/#{user.id}", admin), name: 'foo' }.to change {Project.count}.by(1) - expect(response).to have_http_status(201) + it 'should create new project without name and return 201' do + expect { post api("/projects/user/#{user.id}", admin), path: 'foo' }.to change {Project.count}.by(1) + expect(response.status).to eq(201) end it 'should respond with 400 on failure and not project' do @@ -320,7 +320,8 @@ describe API::API, api: true do description: FFaker::Lorem.sentence, issues_enabled: false, merge_requests_enabled: false, - wiki_enabled: false + wiki_enabled: false, + path: 'foo' }) post api("/projects/user/#{user.id}", admin), project @@ -332,42 +333,42 @@ describe API::API, api: true do end it 'should set a project as public' do - project = attributes_for(:project, :public) + project = attributes_for(:project, :public, path: 'foo') post api("/projects/user/#{user.id}", admin), project expect(json_response['public']).to be_truthy expect(json_response['visibility_level']).to eq(Gitlab::VisibilityLevel::PUBLIC) end it 'should set a project as public using :public' do - project = attributes_for(:project, { public: true }) + project = attributes_for(:project, { public: true, path: 'foo' }) post api("/projects/user/#{user.id}", admin), project expect(json_response['public']).to be_truthy expect(json_response['visibility_level']).to eq(Gitlab::VisibilityLevel::PUBLIC) end it 'should set a project as internal' do - project = attributes_for(:project, :internal) + project = attributes_for(:project, :internal, path: 'foo') post api("/projects/user/#{user.id}", admin), project expect(json_response['public']).to be_falsey expect(json_response['visibility_level']).to eq(Gitlab::VisibilityLevel::INTERNAL) end it 'should set a project as internal overriding :public' do - project = attributes_for(:project, :internal, { public: true }) + project = attributes_for(:project, :internal, { public: true, path: 'foo' }) post api("/projects/user/#{user.id}", admin), project expect(json_response['public']).to be_falsey expect(json_response['visibility_level']).to eq(Gitlab::VisibilityLevel::INTERNAL) end it 'should set a project as private' do - project = attributes_for(:project, :private) + project = attributes_for(:project, :private, path: 'foo') post api("/projects/user/#{user.id}", admin), project expect(json_response['public']).to be_falsey expect(json_response['visibility_level']).to eq(Gitlab::VisibilityLevel::PRIVATE) end it 'should set a project as private using :public' do - project = attributes_for(:project, { public: false }) + project = attributes_for(:project, { public: false, path: 'foo' }) post api("/projects/user/#{user.id}", admin), project expect(json_response['public']).to be_falsey expect(json_response['visibility_level']).to eq(Gitlab::VisibilityLevel::PRIVATE) diff --git a/spec/services/issues/bulk_update_service_spec.rb b/spec/services/issues/bulk_update_service_spec.rb index 4a689e64dc5..86036a4b855 100644 --- a/spec/services/issues/bulk_update_service_spec.rb +++ b/spec/services/issues/bulk_update_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe Issues::BulkUpdateService, services: true do let(:user) { create(:user) } - let(:project) { Projects::CreateService.new(user, namespace: user.namespace, name: 'test').execute } + let(:project) { Projects::CreateService.new(user, namespace: user.namespace, path: 'test').execute } let!(:result) { Issues::BulkUpdateService.new(project, user, params).execute } diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb index fd114359467..ef81a46c70d 100644 --- a/spec/services/projects/create_service_spec.rb +++ b/spec/services/projects/create_service_spec.rb @@ -6,7 +6,8 @@ describe Projects::CreateService, services: true do @user = create :user @opts = { name: "GitLab", - namespace: @user.namespace + namespace: @user.namespace, + path: 'foo' } end |