mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 03:06:53 +08:00
DEV: Use response.parsed_body
in specs (#9615)
Most of it was autofixed with rubocop-discourse 2.1.1.
This commit is contained in:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user