debian-mirror-gitlab/spec/workers/build_success_worker_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
836 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
2016-11-03 12:29:30 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe BuildSuccessWorker do
2016-11-03 12:29:30 +05:30
describe '#perform' do
2018-12-13 13:39:08 +05:30
subject { described_class.new.perform(build.id) }
2016-11-03 12:29:30 +05:30
context 'when build exists' do
2018-12-13 13:39:08 +05:30
context 'when the build will stop an environment' do
let!(:build) { create(:ci_build, :stop_review_app, environment: environment.name, project: environment.project) }
let(:environment) { create(:environment, state: :available) }
it 'stops the environment' do
expect(environment).to be_available
subject
2016-11-03 12:29:30 +05:30
2018-12-13 13:39:08 +05:30
expect(environment.reload).to be_stopped
2016-11-03 12:29:30 +05:30
end
end
end
context 'when build does not exist' do
it 'does not raise exception' do
expect { described_class.new.perform(123) }
.not_to raise_error
end
end
end
end