Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinnie Hellmann <winnie@gitlab.com>2018-10-22 23:06:05 +0300
committerWinnie Hellmann <winnie@gitlab.com>2018-10-22 23:06:05 +0300
commit53be95daf41fc4e59deab149485210835e7e54cd (patch)
tree3f377dcc6289049581e2473b7e12f260e774784f /spec/models/deployment_spec.rb
parent3fb7a1f97a812b7b2b5e80a8a0575cb7bfd2d3c4 (diff)
parentd6be7ed79557ce31a5d0062ceea00c877157a6c7 (diff)
Merge branch 'master' into scheduled-manual-jobs-environment-play-buttons
Conflicts: spec/javascripts/environments/environment_actions_spec.js
Diffstat (limited to 'spec/models/deployment_spec.rb')
-rw-r--r--spec/models/deployment_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb
index 9007418ac35..146d35122f7 100644
--- a/spec/models/deployment_spec.rb
+++ b/spec/models/deployment_spec.rb
@@ -55,6 +55,29 @@ describe Deployment do
end
end
+ describe 'scopes' do
+ describe 'last_for_environment' do
+ let(:production) { create(:environment) }
+ let(:staging) { create(:environment) }
+ let(:testing) { create(:environment) }
+
+ let!(:deployments) do
+ [
+ create(:deployment, environment: production),
+ create(:deployment, environment: staging),
+ create(:deployment, environment: production)
+ ]
+ end
+
+ it 'retrieves last deployments for environments' do
+ last_deployments = described_class.last_for_environment([staging, production, testing])
+
+ expect(last_deployments.size).to eq(2)
+ expect(last_deployments).to match_array(deployments.last(2))
+ end
+ end
+ end
+
describe '#includes_commit?' do
let(:project) { create(:project, :repository) }
let(:environment) { create(:environment, project: project) }