Skip to content

Commit

Permalink
fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Oct 26, 2020
1 parent 9ba37f8 commit 9af23dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 0 additions & 1 deletion app/models/claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,5 @@ def self.import_by_id(options={})

def set_defaults
self.claim_action = "create" if claim_action.blank?
self.source_id = "orcid_update" if source_id.blank?
end
end
10 changes: 3 additions & 7 deletions spec/requests/claims_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

it "admin user" do
post uri, params, headers

puts last_response.body
expect(last_response.status).to eq(202)
response = JSON.parse(last_response.body)
expect(response["errors"]).to be_nil
Expand Down Expand Up @@ -159,14 +159,10 @@

it "JSON" do
post uri, params, headers
expect(last_response.status).to eq(202)
expect(last_response.status).to eq(422)

response = JSON.parse(last_response.body)
expect(response["errors"]).to be_nil
expect(response.dig("data", "attributes", "orcid")).to start_with("https://orcid.org/0000-0002-1825-000")
expect(response.dig("data", "attributes", "doi")).to eq("https://doi.org/10.5061/DRYAD.781PV")
expect(response.dig("data", "attributes", "sourceId")).to eq("orcid_update")
expect(response.dig("data", "attributes", "state")).to eq("waiting")
expect(response).to eq("errors"=>[{"source"=>"source_id", "title"=>"Can't be blank"}])
end
end

Expand Down

0 comments on commit 9af23dd

Please sign in to comment.