diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-05 13:37:50 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-05 13:37:50 +0200 |
commit | 782c8f9aa0a32def807da126e9f07f278772b6a2 (patch) | |
tree | f365c204920467226d5cb7f19ba43a44a838a37d /spec | |
parent | d2d2df0738f3cd8311963c34d90ebc8ce4081aa6 (diff) | |
download | gitlab-ce-782c8f9aa0a32def807da126e9f07f278772b6a2.tar.gz |
Fix triggers spec
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/ci/create_trigger_request_service_spec.rb | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/spec/services/ci/create_trigger_request_service_spec.rb b/spec/services/ci/create_trigger_request_service_spec.rb index 525a24cc200..7aa1912b2a3 100644 --- a/spec/services/ci/create_trigger_request_service_spec.rb +++ b/spec/services/ci/create_trigger_request_service_spec.rb @@ -3,19 +3,19 @@ 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(:gl_project) { FactoryGirl.create :project, gitlab_ci_project: project } let(:trigger) { FactoryGirl.create :ci_trigger, project: project } + before do + stub_ci_commit_to_return_yaml_file + end + describe :execute do context 'valid params' do subject { service.execute(project, trigger, 'master') } - before do - @commit = FactoryGirl.create :ci_commit, gl_project: gl_project - end - it { expect(subject).to be_kind_of(Ci::TriggerRequest) } - it { expect(subject.commit).to eq(@commit) } + it { expect(subject.commit).to be_kind_of(Ci::Commit) } end context 'no commit for ref' do @@ -28,26 +28,11 @@ describe Ci::CreateTriggerRequestService do subject { service.execute(project, trigger, 'master') } before do - FactoryGirl.create :ci_commit_without_jobs, gl_project: gl_project + stub_ci_commit_yaml_file('{}') + FactoryGirl.create :ci_commit, gl_project: gl_project end it { expect(subject).to be_nil } end - - context 'for multiple commits' do - subject { service.execute(project, trigger, 'master') } - - before do - @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 - it { expect(subject).to be_kind_of(Ci::TriggerRequest) } - it { expect(subject).to be_persisted } - it { expect(subject.commit).to eq(@commit2) } - end - end end end |