diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-07-19 19:08:34 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-07-19 19:08:34 +0300 |
commit | a05bc477b99500fa919295e1086f7a8de903e3c4 (patch) | |
tree | 12a04ccc7551ff3eaae9ce7ae2d07c6e11886f93 /spec/services/ci | |
parent | d035d735242a47bee7cd5973c9daa7d984800700 (diff) |
Use hash to return multiple objects
Diffstat (limited to 'spec/services/ci')
-rw-r--r-- | spec/services/ci/create_trigger_request_service_spec.rb | 26 |
1 files changed, 13 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 8582c74e734..48d9b0844f1 100644 --- a/spec/services/ci/create_trigger_request_service_spec.rb +++ b/spec/services/ci/create_trigger_request_service_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Ci::CreateTriggerRequestService, services: true do - let(:service) { described_class.new } + let(:service) { described_class } let(:project) { create(:project, :repository) } let(:trigger) { create(:ci_trigger, project: project, owner: owner) } let(:owner) { create(:user) } @@ -17,26 +17,26 @@ describe Ci::CreateTriggerRequestService, services: true do subject { service.execute(project, trigger, 'master') } 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.pipeline).to be_trigger } - it { expect(subject.builds.first).to be_kind_of(Ci::Build) } + it { expect(subject[:trigger_request]).to be_kind_of(Ci::TriggerRequest) } + it { expect(subject[:trigger_request].builds.first).to be_kind_of(Ci::Build) } + it { expect(subject[:pipeline]).to be_kind_of(Ci::Pipeline) } + it { expect(subject[:pipeline]).to be_trigger } end context 'with owner' do - it { expect(subject).to be_kind_of(Ci::TriggerRequest) } - it { expect(subject.pipeline).to be_kind_of(Ci::Pipeline) } - it { expect(subject.pipeline).to be_trigger } - 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) } + it { expect(subject[:trigger_request]).to be_kind_of(Ci::TriggerRequest) } + it { expect(subject[:trigger_request].builds.first).to be_kind_of(Ci::Build) } + it { expect(subject[:trigger_request].builds.first.user).to eq(owner) } + it { expect(subject[:pipeline]).to be_kind_of(Ci::Pipeline) } + it { expect(subject[:pipeline]).to be_trigger } + it { expect(subject[:pipeline].user).to eq(owner) } end end context 'no commit for ref' do subject { service.execute(project, trigger, 'other-branch') } - it { expect(subject.pipeline).not_to be_persisted } + it { expect(subject[:pipeline]).not_to be_persisted } end context 'no builds created' do @@ -46,7 +46,7 @@ describe Ci::CreateTriggerRequestService, services: true do stub_ci_pipeline_yaml_file('script: { only: [develop], script: hello World }') end - it { expect(subject.pipeline).not_to be_persisted } + it { expect(subject[:pipeline]).not_to be_persisted } end end end |