diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-07 21:07:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-07 21:07:51 +0300 |
commit | 6cae2159b8ce1e84fad48f3dbd5368995cbd87b1 (patch) | |
tree | 46d6b7cbd78d72fe5dcb5d6b1ed973b30deadc71 /spec/serializers/project_import_entity_spec.rb | |
parent | 84f9f0cb8137637708a41152347e7754c1e9fb83 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers/project_import_entity_spec.rb')
-rw-r--r-- | spec/serializers/project_import_entity_spec.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/serializers/project_import_entity_spec.rb b/spec/serializers/project_import_entity_spec.rb index 94af9f1cbd8..6d292d18ae7 100644 --- a/spec/serializers/project_import_entity_spec.rb +++ b/spec/serializers/project_import_entity_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ProjectImportEntity do +RSpec.describe ProjectImportEntity, feature_category: :importers do include ImportHelper let_it_be(:project) { create(:project, import_status: :started, import_source: 'namespace/project') } @@ -10,6 +10,10 @@ RSpec.describe ProjectImportEntity do let(:provider_url) { 'https://provider.com' } let(:entity) { described_class.represent(project, provider_url: provider_url) } + before do + create(:import_failure, project: project) + end + describe '#as_json' do subject { entity.as_json } @@ -18,6 +22,19 @@ RSpec.describe ProjectImportEntity do 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])) + expect(subject[:import_error]).to eq(nil) + end + + context 'when import is failed' do + let!(:last_import_failure) { create(:import_failure, project: project, exception_message: 'LAST ERROR') } + + before do + project.import_state.fail_op! + end + + it 'includes only the last import failure' do + expect(subject[:import_error]).to eq(last_import_failure.exception_message) + end end end end |