Skip to content

Commit

Permalink
cleanup event spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jun 9, 2019
1 parent 4c2caf5 commit 5f2bd1f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions spec/requests/events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
let(:errors) { [{ "status" => "401", "title"=>"Bad credentials."}] }

# Successful response from creating via the API.
let(:success) { { "id"=> event.uuid,
"type"=>"events",
let(:success) { { "id" => event.uuid,
"type" => "events",
"attributes"=>{
"subjId"=>"http://www.citeulike.org/user/dbogartoit",
"objId"=>"http://doi.org/10.1371/journal.pmed.0030186",
"subjId" => "http://www.citeulike.org/user/dbogartoit",
"objId" => "http://doi.org/10.1371/journal.pmed.0030186",
"messageAction"=>"create",
"sourceToken"=>"citeulike_123",
"relationTypeId"=>"bookmarks",
Expand Down Expand Up @@ -49,6 +49,7 @@
let(:uri) { "/events" }
let(:params) do
{ "data" => { "type" => "events",
"id" => event.uuid,
"attributes" => {
"subjId" => event.subj_id,
"subj" => event.subj,
Expand All @@ -64,7 +65,7 @@

expect(last_response.status).to eq(201)
expect(json["errors"]).to be_nil
expect(json.dig("data", "id")).not_to eq(event.uuid)
expect(json.dig("data", "id")).to eq(event.uuid)
expect(json.dig("data", "relationships", "subj", "data")).to eq("id"=>event.subj_id, "type"=>"objects")
end
end
Expand Down Expand Up @@ -227,7 +228,7 @@
expect(last_response.status).to eq(200)
expect(json["errors"]).to be_nil
expect(json.dig("data", "id")).to eq(event.uuid)
expect(json.dig("data", "relationships", "subj", "data")).to eq("id"=>event.subj_id, "type"=>"objects")
expect(json.dig("data", "relationships", "subj", "data")).to eq("id" => event.subj_id, "type"=>"objects")
end
end
end
Expand Down

0 comments on commit 5f2bd1f

Please sign in to comment.