From e77ab6a03f5b62f7321a82d7ff89bedeb64c5c07 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Tue, 22 Dec 2020 21:35:01 +0100 Subject: [PATCH] add rights_list test. #691 --- spec/models/doi_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/models/doi_spec.rb b/spec/models/doi_spec.rb index 19dd24bce..d7d692e9d 100644 --- a/spec/models/doi_spec.rb +++ b/spec/models/doi_spec.rb @@ -338,6 +338,13 @@ expect(doi.errors.details).to eq(rights_list: [{ error: "Rights should not have a length of more than 2000 characters." }]) end + it "nil rights" do + doi.rights_list = [{ "rights" => nil }] + expect(doi.save).to be true + expect(doi.errors.details).to be_empty + expect(doi.rights_list).to eq([]) + end + it "hash rightsIdentifier" do doi.rights_list = [{ "rightsIdentifier" => "CC-BY-4.0" }] expect(doi.save).to be true