summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-30 22:42:13 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-30 22:42:13 +0000
commitd455bcf1e412ab4a4abdfbe691fc40e3d4a0ce8a (patch)
tree05455701cc0a4a220d3c1e089b39a01a310aa2a2 /spec
parentb8cacd68a6297f2c6cdd454a3d82a487367f2e70 (diff)
downloadgitlab-ce-d455bcf1e412ab4a4abdfbe691fc40e3d4a0ce8a.tar.gz
Add latest changes from gitlab-org/security/gitlab@13-10-stable-ee
Diffstat (limited to 'spec')
-rw-r--r--spec/factories/pool_repositories.rb2
-rw-r--r--spec/requests/api/system_hooks_spec.rb10
-rw-r--r--spec/services/projects/fork_service_spec.rb2
-rw-r--r--spec/services/projects/unlink_fork_service_spec.rb11
4 files changed, 18 insertions, 7 deletions
diff --git a/spec/factories/pool_repositories.rb b/spec/factories/pool_repositories.rb
index f0905d28c70..f3f3e33189b 100644
--- a/spec/factories/pool_repositories.rb
+++ b/spec/factories/pool_repositories.rb
@@ -6,7 +6,7 @@ FactoryBot.define do
state { :none }
before(:create) do |pool|
- pool.source_project = create(:project, :repository)
+ pool.source_project ||= create(:project, :repository)
pool.source_project.update!(pool_repository: pool)
end
diff --git a/spec/requests/api/system_hooks_spec.rb b/spec/requests/api/system_hooks_spec.rb
index 01b46053d52..3cea1af686e 100644
--- a/spec/requests/api/system_hooks_spec.rb
+++ b/spec/requests/api/system_hooks_spec.rb
@@ -103,15 +103,15 @@ RSpec.describe API::SystemHooks do
end
end
- describe "GET /hooks/:id" do
- it "returns hook by id" do
- get api("/hooks/#{hook.id}", admin)
- expect(response).to have_gitlab_http_status(:ok)
+ describe 'POST /hooks/:id' do
+ it "returns and trigger hook by id" do
+ post api("/hooks/#{hook.id}", admin)
+ expect(response).to have_gitlab_http_status(:created)
expect(json_response['event_name']).to eq('project_create')
end
it "returns 404 on failure" do
- get api("/hooks/404", admin)
+ post api("/hooks/404", admin)
expect(response).to have_gitlab_http_status(:not_found)
end
end
diff --git a/spec/services/projects/fork_service_spec.rb b/spec/services/projects/fork_service_spec.rb
index df02f8ea15d..276656656ec 100644
--- a/spec/services/projects/fork_service_spec.rb
+++ b/spec/services/projects/fork_service_spec.rb
@@ -403,7 +403,7 @@ RSpec.describe Projects::ForkService do
end
context 'when forking with object pools' do
- let(:fork_from_project) { create(:project, :public) }
+ let(:fork_from_project) { create(:project, :repository, :public) }
let(:forker) { create(:user) }
context 'when no pool exists' do
diff --git a/spec/services/projects/unlink_fork_service_spec.rb b/spec/services/projects/unlink_fork_service_spec.rb
index 2a8965e62ce..90def365fca 100644
--- a/spec/services/projects/unlink_fork_service_spec.rb
+++ b/spec/services/projects/unlink_fork_service_spec.rb
@@ -207,6 +207,17 @@ RSpec.describe Projects::UnlinkForkService, :use_clean_rails_memory_store_cachin
end
end
+ context 'a project with pool repository' do
+ let(:project) { create(:project, :public, :repository) }
+ let!(:pool_repository) { create(:pool_repository, :ready, source_project: project) }
+
+ subject { described_class.new(project, user) }
+
+ it 'when unlinked leaves pool repository' do
+ expect { subject.execute }.to change { project.reload.has_pool_repository? }.from(true).to(false)
+ end
+ end
+
context 'when given project is not part of a fork network' do
let!(:project_without_forks) { create(:project, :public) }