Skip to content

Commit

Permalink
Default to the Work headers if object type is nil or undefined (#137)
Browse files Browse the repository at this point in the history
* Default to the Work headers if object type is nil or undefined

* Update test to reflect fixture
  • Loading branch information
maxkadel committed Sep 28, 2021
1 parent a14a103 commit 20a331a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/uploaders/zizia/csv_manifest_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,18 @@ def missing_headers
end

def required_headers(object_type = "w")
return work_headers if object_type.nil?
if object_type.casecmp("c").zero? || object_type.casecmp("collection").zero?
['title', 'visibility']
else
['title', 'creator', 'keyword', 'rights statement', 'visibility', 'files', 'deduplication_key']
work_headers
end
end

def work_headers
['title', 'creator', 'keyword', 'rights statement', 'visibility', 'files', 'deduplication_key']
end

def duplicate_headers
duplicates = []
sorted_headers = @transformed_headers.sort
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Collection,Collection of fruits,,,,public,,def/234
w,Work on tomatoes,"Tomato, Tommy",fruits|~|tomatoes,http://rightsstatements.org/vocab/InC/1.0/,public,birds.jpg,abc/123
wOrk,Work on cabbages,"Cabbage, Carl",vegetables|~|cabbages,http://rightsstatements.org/vocab/InC/1.0/,public,dog.jpg,abs/234
coLLEction,Collection of legumes,,,,public,,def/345
,Work without object type,"Cabbage, Carl",vegetables|~|cabbages,http://rightsstatements.org/vocab/InC/1.0/,public,dog.jpg,abc/345
2 changes: 1 addition & 1 deletion spec/dummy/spec/system/import_from_csv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
attach_file('csv_import[manifest]', csv_file, make_visible: true)
click_on 'Preview Import'
click_on 'Start Import'
end.to change { Work.count }.by(2)
end.to change { Work.count }.by(3)
.and change { Collection.count }.by(3)
end
end
Expand Down

0 comments on commit 20a331a

Please sign in to comment.