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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-11 18:09:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-11 18:09:37 +0300
commita210c43e0aca0311cc1d3d381763b25979ec72dc (patch)
tree0325d173da7a6e7bd6c2cdf450d0aa1c4e142d0f /spec/models/environment_spec.rb
parentc9687bdf58e9d4a9c3942f587bd4841f42e3b5de (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/environment_spec.rb')
-rw-r--r--spec/models/environment_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb
index 03aef7aea5c..6020db09ccf 100644
--- a/spec/models/environment_spec.rb
+++ b/spec/models/environment_spec.rb
@@ -1266,4 +1266,39 @@ describe Environment, :use_clean_rails_memory_store_caching do
expect(env).to be_persisted
end
end
+
+ describe '#elastic_stack_available?' do
+ let!(:cluster) { create(:cluster, :project, :provided_by_user, projects: [project]) }
+ let!(:deployment) { create(:deployment, :success, environment: environment, project: project, cluster: cluster) }
+
+ context 'when app does not exist' do
+ it 'returns false' do
+ expect(environment.elastic_stack_available?).to be(false)
+ end
+ end
+
+ context 'when app exists' do
+ let!(:application) { create(:clusters_applications_elastic_stack, cluster: cluster) }
+
+ it 'returns false' do
+ expect(environment.elastic_stack_available?).to be(false)
+ end
+ end
+
+ context 'when app is installed' do
+ let!(:application) { create(:clusters_applications_elastic_stack, :installed, cluster: cluster) }
+
+ it 'returns true' do
+ expect(environment.elastic_stack_available?).to be(true)
+ end
+ end
+
+ context 'when app is updated' do
+ let!(:application) { create(:clusters_applications_elastic_stack, :updated, cluster: cluster) }
+
+ it 'returns true' do
+ expect(environment.elastic_stack_available?).to be(true)
+ end
+ end
+ end
end