From 248873343eb14c0e6ac98da4bf36b5acb59d812a Mon Sep 17 00:00:00 2001 From: Richard Hallett Date: Tue, 30 Jul 2019 10:35:50 +0200 Subject: [PATCH] Remove support for single landingPage attribute with params. Ref #325 --- app/controllers/dois_controller.rb | 1 - spec/requests/dois_spec.rb | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/dois_controller.rb b/app/controllers/dois_controller.rb index 3737fa465..03ed59ff2 100644 --- a/app/controllers/dois_controller.rb +++ b/app/controllers/dois_controller.rb @@ -502,7 +502,6 @@ def safe_params { dates: [:date, :dateType, :dateInformation] }, :subjects, { subjects: [:subject, :subjectScheme, :schemeUri, :valueUri, :lang] }, - :landingPage, { landingPage: [ :checked, diff --git a/spec/requests/dois_spec.rb b/spec/requests/dois_spec.rb index 9305a971b..062008fe4 100644 --- a/spec/requests/dois_spec.rb +++ b/spec/requests/dois_spec.rb @@ -2379,6 +2379,13 @@ expect(json.dig('data', 'attributes', 'landingPage')).to eq(landing_page) expect(json.dig('data', 'attributes', 'state')).to eq("findable") end + + it 'fails to create a doi with bad data' do + valid_attributes['data']['attributes']['landingPage'] = "http://example.com" + post '/dois', valid_attributes.to_json, { 'HTTP_ACCEPT'=>'application/vnd.api+json', 'CONTENT_TYPE'=>'application/vnd.api+json', 'HTTP_AUTHORIZATION' => 'Bearer ' + bearer } + + expect(last_response.status).to eq(422) + end end context 'update with landing page info as admin' do