diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-17 12:08:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-17 12:08:52 +0300 |
commit | 53ae6b7e3f83591ad251a3f771f5bf3b8cf087ba (patch) | |
tree | 5180b96d6a84f36a515cedfa8e81d72de5ccf4fb /spec/models | |
parent | cfe63cce6a90a1c70397c1b9f6d90480f25cae0a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/deployment_spec.rb | 39 | ||||
-rw-r--r-- | spec/models/project_ci_cd_setting_spec.rb | 6 |
2 files changed, 45 insertions, 0 deletions
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb index 257f699a459..ab7e12cd43c 100644 --- a/spec/models/deployment_spec.rb +++ b/spec/models/deployment_spec.rb @@ -281,6 +281,45 @@ describe Deployment do expect(last_deployments).to match_array(deployments.last(2)) end end + + describe 'active' do + subject { described_class.active } + + it 'retrieves the active deployments' do + deployment1 = create(:deployment, status: :created ) + deployment2 = create(:deployment, status: :running ) + create(:deployment, status: :failed ) + create(:deployment, status: :canceled ) + + is_expected.to contain_exactly(deployment1, deployment2) + end + end + + describe 'older_than' do + let(:deployment) { create(:deployment) } + + subject { described_class.older_than(deployment) } + + it 'retrives the correct older deployments' do + older_deployment1 = create(:deployment) + older_deployment2 = create(:deployment) + deployment + create(:deployment) + + is_expected.to contain_exactly(older_deployment1, older_deployment2) + end + end + + describe 'with_deployable' do + subject { described_class.with_deployable } + + it 'retrieves deployments with deployable builds' do + with_deployable = create(:deployment) + create(:deployment, deployable: nil) + + is_expected.to contain_exactly(with_deployable) + end + end end describe '#includes_commit?' do diff --git a/spec/models/project_ci_cd_setting_spec.rb b/spec/models/project_ci_cd_setting_spec.rb index eb3a7e527c9..312cbbb0948 100644 --- a/spec/models/project_ci_cd_setting_spec.rb +++ b/spec/models/project_ci_cd_setting_spec.rb @@ -32,6 +32,12 @@ describe ProjectCiCdSetting do end end + describe '#forward_deployment_enabled' do + it 'is true by default' do + expect(described_class.new.forward_deployment_enabled).to be_truthy + end + end + describe '#default_git_depth' do let(:default_value) { described_class::DEFAULT_GIT_DEPTH } |