Skip to content

Commit

Permalink
Fix error message formatting in PL upload
Browse files Browse the repository at this point in the history
  • Loading branch information
kammerer committed Feb 27, 2018
1 parent 68dc259 commit f014dbe
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
31 changes: 15 additions & 16 deletions config/locales/errors.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,21 @@ en:
submission/upload:
attributes:
file:
no_header: 'No correct header provided. At least four columns are expected.'
no_header_plant_lines: 'No correct header provided.'
no_plant_accession_header: 'No correct header provided. Please provide the "Plant accession" column.'
no_originating_organisation_header: 'No correct header provided. Please provide the "Originating organisation" column.'
no_year_produced_header: 'No correct header provided. Please provide the "Year produced" column.'
no_plant_line_header: 'No correct header provided. Please provide the "Plant line" column.'
no_common_name_header: 'No correct header provided. Please provide the "Common name" column.'
no_previous_line_name_header: 'No correct header provided. Please provide the "Previous line name" column.'
no_genetic_status_header: 'No correct header provided. Please provide the "Genetic status" column.'
no_sequence_header: 'No correct header provided. Please provide the "Sequence" column.'
no_line_or_variety_header: 'No correct header provided. Please provide either the "Plant line" or the "Plant variety" column.'
no_plant_variety_header: 'No correct header provided. Please provide the "Plant variety" column.'
no_species_header: 'No correct header provided. Please provide the "Species" column.'
no_crop_type_header: 'No correct header provided. Please provide the "Crop type" column.'
non_unique_mapping: 'Detected non unique column headers mapping
to traits. Please check the column names.'
no_header: 'has no correct header provided. At least four columns are expected.'
no_header_plant_lines: 'has no correct header provided.'
no_plant_accession_header: 'has no correct header provided. Please provide the "Plant accession" column.'
no_originating_organisation_header: 'has no correct header provided. Please provide the "Originating organisation" column.'
no_year_produced_header: 'has no correct header provided. Please provide the "Year produced" column.'
no_plant_line_header: 'has no correct header provided. Please provide the "Plant line" column.'
no_common_name_header: 'has no correct header provided. Please provide the "Common name" column.'
no_previous_line_name_header: 'has no correct header provided. Please provide the "Previous line name" column.'
no_genetic_status_header: 'has no correct header provided. Please provide the "Genetic status" column.'
no_sequence_header: 'has no correct header provided. Please provide the "Sequence" column.'
no_line_or_variety_header: 'has no correct header provided. Please provide either the "Plant line" or the "Plant variety" column.'
no_plant_variety_header: 'has no correct header provided. Please provide the "Plant variety" column.'
no_species_header: 'has no correct header provided. Please provide the "Species" column.'
no_crop_type_header: 'has no correct header provided. Please provide the "Crop type" column.'
non_unique_mapping: 'Detected non unique column headers mapping to traits. Please check the column names.'
trait:
attributes:
name:
Expand Down
4 changes: 2 additions & 2 deletions spec/services/submission/plant_line_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
input_is ''
subject.send(:parse_header)
expect(upload.errors[:file]).
to eq ['No correct header provided.']
to eq ['has no correct header provided.']
end

header = [
Expand All @@ -31,7 +31,7 @@
input_is header.reject{ |c| c == column_name }.join(',')
subject.send(:parse_header)
expect(upload.errors[:file]).
to eq ["No correct header provided. Please provide the \"#{column_name}\" column."]
to eq ["has no correct header provided. Please provide the \"#{column_name}\" column."]
end
end

Expand Down
6 changes: 3 additions & 3 deletions spec/services/submission/trait_score_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
input_is 'single column name'
subject.send(:parse_header)
expect(upload.errors[:file]).
to eq ['No correct header provided. At least four columns are expected.']
to eq ['has no correct header provided. At least four columns are expected.']
end

it 'does nothing with a four-column header' do
Expand All @@ -30,14 +30,14 @@
input_is 'id,pa,oo,yp,pl'
subject.send(:parse_header)
expect(upload.errors[:file]).
to eq ['No correct header provided. Please provide the "Plant accession" column.']
to eq ['has no correct header provided. Please provide the "Plant accession" column.']
end

it 'complains if there is neither Plant line nor Plant variety column' do
input_is 'id,Plant accession,oo,yp,pl'
subject.send(:parse_header)
expect(upload.errors[:file]).
to eq ['No correct header provided. Please provide either the "Plant line" or the "Plant variety" column.']
to eq ['has no correct header provided. Please provide either the "Plant line" or the "Plant variety" column.']
end
end

Expand Down

0 comments on commit f014dbe

Please sign in to comment.