diff options
Diffstat (limited to 'spec/services/deployments/update_environment_service_spec.rb')
-rw-r--r-- | spec/services/deployments/update_environment_service_spec.rb | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/spec/services/deployments/update_environment_service_spec.rb b/spec/services/deployments/update_environment_service_spec.rb index 4485ce585bb..c952bcddd9a 100644 --- a/spec/services/deployments/update_environment_service_spec.rb +++ b/spec/services/deployments/update_environment_service_spec.rb @@ -159,14 +159,37 @@ RSpec.describe Deployments::UpdateEnvironmentService do { name: 'production', auto_stop_in: '1 day' } end + before do + environment.update_attribute(:auto_stop_at, nil) + end + it 'renews auto stop at' do freeze_time do - environment.update!(auto_stop_at: nil) - expect { subject.execute } .to change { environment.reset.auto_stop_at&.round }.from(nil).to(1.day.since.round) end end + + context 'when value is a variable' do + let(:options) { { name: 'production', auto_stop_in: '$TTL' } } + + let(:yaml_variables) do + [ + { key: "TTL", value: '2 days', public: true } + ] + end + + before do + job.update_attribute(:yaml_variables, yaml_variables) + end + + it 'renews auto stop at with expanded variable value' do + freeze_time do + expect { subject.execute } + .to change { environment.reset.auto_stop_at&.round }.from(nil).to(2.days.since.round) + end + end + end end context 'when deployment tier is specified' do |