diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-06 17:11:28 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-06 17:11:28 +0300 |
commit | 07539ab2b07bf2d1e652a34dcabc7cf907cd9906 (patch) | |
tree | 8ba023eb648d009467415fb910ad53c61a2b4b34 /spec/services | |
parent | b7d74401854198c7395d7d2c4ef76d9ef56f6d5f (diff) | |
parent | 348dff0a826c45f00f992e761423a22d2ac32bc3 (diff) |
Merge branch 'master' into pipeline-blocking-actions
* master: (26 commits)
Fix UserBasic
Rename `/take` to `/take_ownership`, expose `owner` in `v3`.
Update after review
Fix values being called at Array instead of Hash
Fix json response in branches controller
Improve docs and specs related to pages artifacts
Add MR fo changelog about removing pages artifacts
Delete artifacts for pages unless expiry date is specified
Lint doc
Improved team selection
Move foreign key to separate migration
Fix import model attributes
Update documentation and expose ID
Introduce tests for pipeline triggers
Fix trigger model
Update db/schema
Make triggers to be user aware
Make Pipeline Triggers to be user aware
Update triggers API
Remove remnants of git annex
...
Conflicts:
db/schema.rb
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/ci/create_trigger_request_service_spec.rb | 18 | ||||
-rw-r--r-- | spec/services/projects/update_pages_service_spec.rb | 22 |
2 files changed, 38 insertions, 2 deletions
diff --git a/spec/services/ci/create_trigger_request_service_spec.rb b/spec/services/ci/create_trigger_request_service_spec.rb index d8c443d29d5..5e68343784d 100644 --- a/spec/services/ci/create_trigger_request_service_spec.rb +++ b/spec/services/ci/create_trigger_request_service_spec.rb @@ -13,8 +13,22 @@ describe Ci::CreateTriggerRequestService, services: true do context 'valid params' do subject { service.execute(project, trigger, 'master') } - it { expect(subject).to be_kind_of(Ci::TriggerRequest) } - it { expect(subject.builds.first).to be_kind_of(Ci::Build) } + context 'without owner' do + it { expect(subject).to be_kind_of(Ci::TriggerRequest) } + it { expect(subject.pipeline).to be_kind_of(Ci::Pipeline) } + it { expect(subject.builds.first).to be_kind_of(Ci::Build) } + end + + context 'with owner' do + let(:owner) { create(:user) } + let(:trigger) { create(:ci_trigger, project: project, owner: owner) } + + it { expect(subject).to be_kind_of(Ci::TriggerRequest) } + it { expect(subject.pipeline).to be_kind_of(Ci::Pipeline) } + it { expect(subject.pipeline.user).to eq(owner) } + it { expect(subject.builds.first).to be_kind_of(Ci::Build) } + it { expect(subject.builds.first.user).to eq(owner) } + end end context 'no commit for ref' do diff --git a/spec/services/projects/update_pages_service_spec.rb b/spec/services/projects/update_pages_service_spec.rb index 411b22a0fb8..f75fdd9e03f 100644 --- a/spec/services/projects/update_pages_service_spec.rb +++ b/spec/services/projects/update_pages_service_spec.rb @@ -26,6 +26,28 @@ describe Projects::UpdatePagesService do build.update_attributes(artifacts_metadata: metadata) end + describe 'pages artifacts' do + context 'with expiry date' do + before do + build.artifacts_expire_in = "2 days" + end + + it "doesn't delete artifacts" do + expect(execute).to eq(:success) + + expect(build.reload.artifacts_file?).to eq(true) + end + end + + context 'without expiry date' do + it "does delete artifacts" do + expect(execute).to eq(:success) + + expect(build.reload.artifacts_file?).to eq(false) + end + end + end + it 'succeeds' do expect(project.pages_deployed?).to be_falsey expect(execute).to eq(:success) |