diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-14 18:07:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-14 18:07:56 +0300 |
commit | 016af097cb1fa872fdc28a786d16315e55cd2701 (patch) | |
tree | 76f97f90a8048685efb3eb0c543b3a75d99be6ee /spec/models/deployment_spec.rb | |
parent | 00b8ecb72c9f77d864aff3572f028613f45af03c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/deployment_spec.rb')
-rw-r--r-- | spec/models/deployment_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb index 522a27954e2..33e4cd34aa5 100644 --- a/spec/models/deployment_spec.rb +++ b/spec/models/deployment_spec.rb @@ -474,4 +474,29 @@ describe Deployment do end end end + + context '#update_status' do + let(:deploy) { create(:deployment, status: :running) } + + it 'changes the status' do + deploy.update_status('success') + + expect(deploy).to be_success + end + + it 'schedules SuccessWorker and FinishedWorker when finishing a deploy' do + expect(Deployments::SuccessWorker).to receive(:perform_async) + expect(Deployments::FinishedWorker).to receive(:perform_async) + + deploy.update_status('success') + end + + it 'updates finished_at when transitioning to a finished status' do + Timecop.freeze do + deploy.update_status('success') + + expect(deploy.read_attribute(:finished_at)).to eq(Time.now) + end + end + end end |