diff options
Diffstat (limited to 'spec/models/import_failure_spec.rb')
-rw-r--r-- | spec/models/import_failure_spec.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/models/import_failure_spec.rb b/spec/models/import_failure_spec.rb index 9fee1b0ae7b..0bdcb6dde31 100644 --- a/spec/models/import_failure_spec.rb +++ b/spec/models/import_failure_spec.rb @@ -10,7 +10,11 @@ RSpec.describe ImportFailure do let_it_be(:soft_failure) { create(:import_failure, :soft_failure, project: project, correlation_id_value: correlation_id) } let_it_be(:unrelated_failure) { create(:import_failure, project: project) } - it 'returns hard failures given a correlation ID' do + it 'returns failures for the given correlation ID' do + expect(ImportFailure.failures_by_correlation_id(correlation_id)).to match_array([hard_failure, soft_failure]) + end + + it 'returns hard failures for the given correlation ID' do expect(ImportFailure.hard_failures_by_correlation_id(correlation_id)).to eq([hard_failure]) end @@ -45,5 +49,15 @@ RSpec.describe ImportFailure do it { is_expected.to validate_presence_of(:group) } end + + describe '#external_identifiers' do + it { is_expected.to allow_value({ note_id: 234, noteable_id: 345, noteable_type: 'MergeRequest' }).for(:external_identifiers) } + it { is_expected.not_to allow_value(nil).for(:external_identifiers) } + it { is_expected.not_to allow_value({ ids: [123] }).for(:external_identifiers) } + + it 'allows up to 3 fields' do + is_expected.not_to allow_value({ note_id: 234, noteable_id: 345, noteable_type: 'MergeRequest', extra_attribute: 'abc' }).for(:external_identifiers) + end + end end end |