blob: 1215b41bd9ff23c059c34776ed8b0beca4a9f4a9 (
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
35
36
37
38
39
40
41
42
43
44
45
46
|
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::JiraImport::Stage::ImportLabelsWorker do
include JiraServiceHelper
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, import_type: 'jira') }
describe 'modules' do
it_behaves_like 'include import workers modules'
end
describe '#perform' do
let_it_be(:jira_import, reload: true) { create(:jira_import_state, :scheduled, project: project) }
context 'when import did not start' do
it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage'
end
context 'when import started' do
let!(:jira_service) { create(:jira_service, project: project) }
before do
stub_jira_service_test
jira_import.start!
WebMock.stub_request(:get, 'https://jira.example.com/rest/api/2/label?maxResults=500&startAt=0')
.to_return(body: {}.to_json )
end
it_behaves_like 'advance to next stage', :issues
it 'executes labels importer' do
expect_next_instance_of(Gitlab::JiraImport::LabelsImporter) do |instance|
expect(instance).to receive(:execute).and_return(Gitlab::JobWaiter.new)
end
described_class.new.perform(project.id)
end
end
end
end
|