Skip to content

Commit

Permalink
Add unpublished file_version test
Browse files Browse the repository at this point in the history
  • Loading branch information
brianzelip committed Feb 24, 2022
1 parent 35be513 commit ca74d63
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions backend/spec/model_digital_object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,31 @@

end

it "doesn't allow an unpublished file_version to be representative" do
json = build(:json_digital_object, {
:publish => true,
:file_versions => [build(:json_file_version, {
:publish => false,
:is_representative => true,
:file_uri => 'http://foo.com/bar1',
:use_statement => 'image-service'
}),
build(:json_file_version, {
:publish => true,
:file_uri => 'http://foo.com/bar2',
:use_statement => 'image-service'
}),
build(:json_file_version, {
:publish => true,
:file_uri => 'http://foo.com/bar3',
:use_statement => 'image-service'
})
]})

expect {
DigitalObject.create_from_json(json)
}.to raise_error(Sequel::ValidationFailed)
end

it "supports optional captions for file versions" do
obj = create(:json_digital_object, {
Expand Down

0 comments on commit ca74d63

Please sign in to comment.