diff --git a/app/controllers/dois_controller.rb b/app/controllers/dois_controller.rb index 216465951..de162d33d 100644 --- a/app/controllers/dois_controller.rb +++ b/app/controllers/dois_controller.rb @@ -507,7 +507,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 7e469794f..6bbc262ad 100644 --- a/spec/requests/dois_spec.rb +++ b/spec/requests/dois_spec.rb @@ -2378,6 +2378,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