diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-10-10 10:47:31 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-10-10 10:47:31 +0900 |
commit | 1f3f06668b273265a96f526039e139629959a890 (patch) | |
tree | fe509e38bb4f07922c4bc765d0663f226f999e10 /spec/serializers | |
parent | 4f49f54af5b49e28801f0934547ff3159161759b (diff) | |
download | gitlab-ce-1f3f06668b273265a96f526039e139629959a890.tar.gz |
Fix and add spec
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/deployment_entity_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/serializers/deployment_entity_spec.rb b/spec/serializers/deployment_entity_spec.rb index 522c92ce295..698fbd818c0 100644 --- a/spec/serializers/deployment_entity_spec.rb +++ b/spec/serializers/deployment_entity_spec.rb @@ -22,4 +22,26 @@ describe DeploymentEntity do it 'exposes creation date' do expect(subject).to include(:created_at) end + + describe 'scheduled_actions' do + let(:project) { create(:project, :repository) } + let(:pipeline) { create(:ci_pipeline, project: project, user: user) } + let(:build) { create(:ci_build, :success, pipeline: pipeline) } + let(:deployment) { create(:deployment, deployable: build) } + + context 'when deployment has another action' do + let(:other_build) { create(:ci_build, :scheduled, pipeline: pipeline, name: 'other build') } + let!(:other_deployment) { create(:deployment, deployable: other_build) } + + it 'returns other actions' do + expect(subject[:scheduled_actions][0][:name]).to eq 'other build' + end + end + + context 'when deployment does not have other actions' do + it 'does not return other actions' do + expect(subject[:scheduled_actions]).to be_empty + end + end + end end |