blob: e7782c2fba1182c03d818559ca9c0d4bb20e4eb2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Environments::CanaryIngress::UpdateWorker do
let_it_be(:environment) { create(:environment) }
let(:worker) { described_class.new }
describe '#perform' do
subject { worker.perform(environment_id, params) }
let(:environment_id) { environment.id }
let(:params) { { 'weight' => 50 } }
it 'executes the update service' do
expect_next_instance_of(Environments::CanaryIngress::UpdateService, environment.project, nil, params) do |service|
expect(service).to receive(:execute).with(environment)
end
subject
end
context 'when an environment does not exist' do
let(:environment_id) { non_existing_record_id }
it 'does not execute the update service' do
expect(Environments::CanaryIngress::UpdateService).not_to receive(:new)
subject
end
end
end
end
|