summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-29 11:44:07 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-29 11:44:07 +0000
commit2c3355f9584a1a22d91806b8b49d441f22c0c286 (patch)
tree60d21258783742373ef3cd1fe4a7536b50e3272b /spec/services
parentbdf466858653c3599f4c9bc0c514fb25018f77aa (diff)
parent0d877d91e7556edfcdc29ad77491740da3cc7661 (diff)
downloadgitlab-ce-2c3355f9584a1a22d91806b8b49d441f22c0c286.tar.gz
Merge branch 'ci-commits-to-projects' into 'master'
Make Ci::Commits belong to Project instead of Ci::Project See merge request !1455
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/ci/create_trigger_request_service_spec.rb11
-rw-r--r--spec/services/ci/image_for_build_service_spec.rb3
-rw-r--r--spec/services/ci/register_build_service_spec.rb11
-rw-r--r--spec/services/ci/web_hook_service_spec.rb3
4 files changed, 15 insertions, 13 deletions
diff --git a/spec/services/ci/create_trigger_request_service_spec.rb b/spec/services/ci/create_trigger_request_service_spec.rb
index d12cd9773dc..525a24cc200 100644
--- a/spec/services/ci/create_trigger_request_service_spec.rb
+++ b/spec/services/ci/create_trigger_request_service_spec.rb
@@ -3,6 +3,7 @@ require 'spec_helper'
describe Ci::CreateTriggerRequestService do
let(:service) { Ci::CreateTriggerRequestService.new }
let(:project) { FactoryGirl.create :ci_project }
+ let(:gl_project) { FactoryGirl.create :empty_project, gitlab_ci_project: project }
let(:trigger) { FactoryGirl.create :ci_trigger, project: project }
describe :execute do
@@ -10,7 +11,7 @@ describe Ci::CreateTriggerRequestService do
subject { service.execute(project, trigger, 'master') }
before do
- @commit = FactoryGirl.create :ci_commit, project: project
+ @commit = FactoryGirl.create :ci_commit, gl_project: gl_project
end
it { expect(subject).to be_kind_of(Ci::TriggerRequest) }
@@ -27,7 +28,7 @@ describe Ci::CreateTriggerRequestService do
subject { service.execute(project, trigger, 'master') }
before do
- FactoryGirl.create :ci_commit_without_jobs, project: project
+ FactoryGirl.create :ci_commit_without_jobs, gl_project: gl_project
end
it { expect(subject).to be_nil }
@@ -37,9 +38,9 @@ describe Ci::CreateTriggerRequestService do
subject { service.execute(project, trigger, 'master') }
before do
- @commit1 = FactoryGirl.create :ci_commit, committed_at: 2.hour.ago, project: project
- @commit2 = FactoryGirl.create :ci_commit, committed_at: 1.hour.ago, project: project
- @commit3 = FactoryGirl.create :ci_commit, committed_at: 3.hour.ago, project: project
+ @commit1 = FactoryGirl.create :ci_commit, committed_at: 2.hour.ago, gl_project: gl_project
+ @commit2 = FactoryGirl.create :ci_commit, committed_at: 1.hour.ago, gl_project: gl_project
+ @commit3 = FactoryGirl.create :ci_commit, committed_at: 3.hour.ago, gl_project: gl_project
end
context 'retries latest one' do
diff --git a/spec/services/ci/image_for_build_service_spec.rb b/spec/services/ci/image_for_build_service_spec.rb
index 7565eb8f032..d7242d684c6 100644
--- a/spec/services/ci/image_for_build_service_spec.rb
+++ b/spec/services/ci/image_for_build_service_spec.rb
@@ -4,7 +4,8 @@ module Ci
describe ImageForBuildService do
let(:service) { ImageForBuildService.new }
let(:project) { FactoryGirl.create(:ci_project) }
- let(:commit) { FactoryGirl.create(:ci_commit, project: project, ref: 'master') }
+ let(:gl_project) { FactoryGirl.create(:empty_project, gitlab_ci_project: project) }
+ let(:commit) { FactoryGirl.create(:ci_commit, gl_project: gl_project, ref: 'master') }
let(:build) { FactoryGirl.create(:ci_build, commit: commit) }
describe :execute do
diff --git a/spec/services/ci/register_build_service_spec.rb b/spec/services/ci/register_build_service_spec.rb
index 7b5af6c3dd0..781764627ac 100644
--- a/spec/services/ci/register_build_service_spec.rb
+++ b/spec/services/ci/register_build_service_spec.rb
@@ -3,14 +3,14 @@ require 'spec_helper'
module Ci
describe RegisterBuildService do
let!(:service) { RegisterBuildService.new }
- let!(:project) { FactoryGirl.create :ci_project }
- let!(:commit) { FactoryGirl.create :ci_commit, project: project }
- let!(:pending_build) { FactoryGirl.create :ci_build, project: project, commit: commit }
+ let!(:gl_project) { FactoryGirl.create :empty_project }
+ let!(:commit) { FactoryGirl.create :ci_commit, gl_project: gl_project }
+ let!(:pending_build) { FactoryGirl.create :ci_build, commit: commit }
let!(:shared_runner) { FactoryGirl.create(:ci_runner, is_shared: true) }
let!(:specific_runner) { FactoryGirl.create(:ci_runner, is_shared: false) }
before do
- specific_runner.assign_to(project)
+ specific_runner.assign_to(gl_project.ensure_gitlab_ci_project)
end
describe :execute do
@@ -47,8 +47,7 @@ module Ci
context 'allow shared runners' do
before do
- project.shared_runners_enabled = true
- project.save
+ gl_project.gitlab_ci_project.update(shared_runners_enabled: true)
end
context 'shared runner' do
diff --git a/spec/services/ci/web_hook_service_spec.rb b/spec/services/ci/web_hook_service_spec.rb
index cebdd145e40..aa48fcbcbfd 100644
--- a/spec/services/ci/web_hook_service_spec.rb
+++ b/spec/services/ci/web_hook_service_spec.rb
@@ -2,7 +2,8 @@ require 'spec_helper'
describe Ci::WebHookService do
let(:project) { FactoryGirl.create :ci_project }
- let(:commit) { FactoryGirl.create :ci_commit, project: project }
+ let(:gl_project) { FactoryGirl.create :empty_project, gitlab_ci_project: project }
+ let(:commit) { FactoryGirl.create :ci_commit, gl_project: gl_project }
let(:build) { FactoryGirl.create :ci_build, commit: commit }
let(:hook) { FactoryGirl.create :ci_web_hook, project: project }