2021-01-29 00:20:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe BulkImports::Pipeline::Context do
|
2021-04-29 21:17:54 +05:30
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
let_it_be(:group) { create(:group) }
|
|
|
|
let_it_be(:bulk_import) { create(:bulk_import, user: user) }
|
|
|
|
|
|
|
|
let_it_be(:entity) do
|
|
|
|
create(
|
|
|
|
:bulk_import_entity,
|
|
|
|
source_full_path: 'source/full/path',
|
|
|
|
destination_name: 'My Destination Group',
|
|
|
|
destination_namespace: group.full_path,
|
|
|
|
group: group,
|
|
|
|
bulk_import: bulk_import
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
let_it_be(:tracker) do
|
|
|
|
create(
|
|
|
|
:bulk_import_tracker,
|
|
|
|
entity: entity,
|
|
|
|
pipeline_name: described_class.name
|
2021-03-11 19:13:27 +05:30
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
subject { described_class.new(tracker, extra: :data) }
|
|
|
|
|
|
|
|
describe '#entity' do
|
|
|
|
it { expect(subject.entity).to eq(entity) }
|
|
|
|
end
|
2021-01-29 00:20:46 +05:30
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
describe '#group' do
|
|
|
|
it { expect(subject.group).to eq(group) }
|
|
|
|
end
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
describe '#bulk_import' do
|
|
|
|
it { expect(subject.bulk_import).to eq(bulk_import) }
|
|
|
|
end
|
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
describe '#current_user' do
|
|
|
|
it { expect(subject.current_user).to eq(user) }
|
|
|
|
end
|
2021-01-29 00:20:46 +05:30
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
describe '#configuration' do
|
2021-03-11 19:13:27 +05:30
|
|
|
it { expect(subject.configuration).to eq(bulk_import.configuration) }
|
2021-01-29 00:20:46 +05:30
|
|
|
end
|
2021-04-29 21:17:54 +05:30
|
|
|
|
|
|
|
describe '#extra' do
|
|
|
|
it { expect(subject.extra).to eq(extra: :data) }
|
|
|
|
end
|
2021-01-29 00:20:46 +05:30
|
|
|
end
|