diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-03-05 18:23:42 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-03-05 18:53:00 +0100 |
commit | 91ce04678ea78f2042026e8584e5d1069853dbc4 (patch) | |
tree | d26addff8e83b10704ea67ba2c1cd460adf4b9ea /spec/services | |
parent | 0a75de2909152351483b317024fcab2e9bb08e16 (diff) | |
download | gitlab-ce-91ce04678ea78f2042026e8584e5d1069853dbc4.tar.gz |
Make triggers to be user aware
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/ci/create_trigger_request_service_spec.rb | 18 |
1 files changed, 16 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 |