DEV: Use response.parsed_body in specs (#9615)

Most of it was autofixed with rubocop-discourse 2.1.1.
This commit is contained in:
Jarek Radosz
2020-05-07 17:04:12 +02:00
committed by GitHub
parent 69ef0da4c2
commit 781e3f5e10
70 changed files with 705 additions and 714 deletions

View File

@ -33,7 +33,7 @@ describe DraftController do
get "/draft.json", params: { draft_key: 'hello' }
expect(response.status).to eq(200)
json = ::JSON.parse(response.body)
json = response.parsed_body
expect(json['draft']).to eq('test')
get "/draft.json"
@ -54,7 +54,7 @@ describe DraftController do
}.to_json
}
expect(JSON.parse(response.body)['conflict_user']).to eq(nil)
expect(response.parsed_body['conflict_user']).to eq(nil)
post "/draft.json", params: {
draft_key: "topic",
@ -66,7 +66,7 @@ describe DraftController do
}.to_json
}
json = JSON.parse(response.body)
json = response.parsed_body
expect(json['conflict_user']['id']).to eq(post.last_editor.id)
expect(json['conflict_user']).to include('avatar_template')
@ -94,7 +94,7 @@ describe DraftController do
}
expect(response.status).to eq(200)
json = JSON.parse(response.body)
json = response.parsed_body
expect(json["draft_sequence"]).to eq(1)
end
@ -110,7 +110,7 @@ describe DraftController do
expect(response.status).to eq(200)
json = JSON.parse(response.body)
json = response.parsed_body
expect(json["draft_sequence"]).to eq(0)
post "/draft.json", params: {
@ -121,7 +121,7 @@ describe DraftController do
}
expect(response.status).to eq(200)
json = JSON.parse(response.body)
json = response.parsed_body
expect(json["draft_sequence"]).to eq(1)
expect(DraftSequence.current(user, "abc")).to eq(1)
@ -134,7 +134,7 @@ describe DraftController do
}
expect(response.status).to eq(200)
json = JSON.parse(response.body)
json = response.parsed_body
expect(json["draft_sequence"]).to eq(1)
post "/draft.json", params: {
@ -145,7 +145,7 @@ describe DraftController do
}
expect(response.status).to eq(200)
json = JSON.parse(response.body)
json = response.parsed_body
expect(json["draft_sequence"]).to eq(2)
end