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:
Diffstat (limited to 'spec/models/environment_spec.rb')
-rw-r--r--spec/models/environment_spec.rb28
1 files changed, 9 insertions, 19 deletions
diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb
index fd89a3a2e22..e3207636bdc 100644
--- a/spec/models/environment_spec.rb
+++ b/spec/models/environment_spec.rb
@@ -34,6 +34,14 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
it { is_expected.to validate_length_of(:external_url).is_at_most(255) }
+ describe 'validation' do
+ it 'does not become invalid record when external_url is empty' do
+ environment = build(:environment, external_url: nil)
+
+ expect(environment).to be_valid
+ end
+ end
+
describe '.before_save' do
it 'ensures environment tier when a new object is created' do
environment = build(:environment, name: 'gprd', tier: nil)
@@ -1672,6 +1680,7 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
'abcdef' | ChronicDuration::DurationParseError
'' | nil
nil | nil
+ 'never' | nil
end
with_them do
it 'sets correct auto_stop_in' do
@@ -1711,25 +1720,6 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do
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 integration does not exist' do
- it 'returns false' do
- expect(environment.elastic_stack_available?).to be(false)
- end
- end
-
- context 'when integration is enabled' do
- let!(:integration) { create(:clusters_integrations_elastic_stack, cluster: cluster) }
-
- it 'returns true' do
- expect(environment.elastic_stack_available?).to be(true)
- end
- end
- end
-
describe '#destroy' do
it 'remove the deployment refs from gitaly' do
deployment = create(:deployment, :success, environment: environment, project: project)