2018-11-07 11:44:21 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe ProjectImportEntity do
|
2018-11-07 11:44:21 -05:00
|
|
|
include ImportHelper
|
|
|
|
|
2020-02-24 22:08:49 -05:00
|
|
|
let_it_be(:project) { create(:project, import_status: :started, import_source: 'namespace/project') }
|
2021-04-14 11:09:04 -04:00
|
|
|
|
2018-11-07 11:44:21 -05:00
|
|
|
let(:provider_url) { 'https://provider.com' }
|
|
|
|
let(:entity) { described_class.represent(project, provider_url: provider_url) }
|
|
|
|
|
|
|
|
describe '#as_json' do
|
|
|
|
subject { entity.as_json }
|
|
|
|
|
|
|
|
it 'includes required fields' do
|
|
|
|
expect(subject[:import_source]).to eq(project.import_source)
|
|
|
|
expect(subject[:import_status]).to eq(project.import_status)
|
|
|
|
expect(subject[:human_import_status_name]).to eq(project.human_import_status_name)
|
|
|
|
expect(subject[:provider_link]).to eq(provider_project_link_url(provider_url, project[:import_source]))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|