diff --git a/app/models/concerns/checkable.rb b/app/models/concerns/checkable.rb index 651ca8a54..74c5c9dff 100644 --- a/app/models/concerns/checkable.rb +++ b/app/models/concerns/checkable.rb @@ -19,19 +19,15 @@ def get_landing_page_info(doi: nil, url: nil, keep: true) checked = Time.zone.now - doi.update_columns(last_landing_page_status: response.status, - last_landing_page_content_type: content_type, - last_landing_page_status_check: checked) if doi.present? - { "status" => response.status, "content-type" => content_type, "checked" => checked.utc.iso8601 } rescue URI::InvalidURIError => e logger = Logger.new(STDOUT) logger.error e.message - - { "status" => 404, - "content_type" => nil, + + { "status" => 404, + "content_type" => nil, "checked" => Time.zone.now.utc.iso8601 } end end diff --git a/spec/concerns/checkable_spec.rb b/spec/concerns/checkable_spec.rb index 656d085af..7345e72bc 100644 --- a/spec/concerns/checkable_spec.rb +++ b/spec/concerns/checkable_spec.rb @@ -34,8 +34,6 @@ response = Doi.get_landing_page_info(doi: doi) expect(response["status"]).to eq(200) expect(response["content-type"]).to eq("text/html") - expect(doi.last_landing_page_status).to eq(200) - expect(doi.last_landing_page_content_type).to eq("text/html") end it 'content type pdf' do @@ -43,22 +41,18 @@ response = Doi.get_landing_page_info(doi: doi) expect(response["status"]).to eq(200) expect(response["content-type"]).to eq("application/pdf") - expect(doi.last_landing_page_status).to eq(200) - expect(doi.last_landing_page_content_type).to eq("application/pdf") end it 'not found' do doi = create(:doi, url: "https://blog.datacite.org/xxx") response = Doi.get_landing_page_info(doi: doi) expect(response["status"]).to eq(404) - expect(doi.last_landing_page_status).to eq(404) end it 'no url' do doi = create(:doi, url: nil) response = Doi.get_landing_page_info(doi: doi) expect(response["status"]).to eq(404) - expect(doi.last_landing_page_status).to eq(nil) end end end