mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
DEV: Improve tests to provide better errors when it fails.
This commit is contained in:
parent
e28af0429c
commit
d5df1db3c4
@ -839,11 +839,17 @@ describe PostsController do
|
|||||||
raw = "this is a test post 123 #{SecureRandom.hash}"
|
raw = "this is a test post 123 #{SecureRandom.hash}"
|
||||||
title = "this is a title #{SecureRandom.hash}"
|
title = "this is a title #{SecureRandom.hash}"
|
||||||
|
|
||||||
post "/posts.json", params: { raw: raw, title: title, wpid: 1 }
|
expect do
|
||||||
|
post "/posts.json", params: { raw: raw, title: title, wpid: 1 }
|
||||||
|
end.to change { Post.count }
|
||||||
|
|
||||||
expect(response.status).to eq(200)
|
expect(response.status).to eq(200)
|
||||||
|
|
||||||
post "/posts.json", params: { raw: raw, title: title, wpid: 2 }
|
expect do
|
||||||
expect(response).not_to be_successful
|
post "/posts.json", params: { raw: raw, title: title, wpid: 2 }
|
||||||
|
end.to_not change { Post.count }
|
||||||
|
|
||||||
|
expect(response.status).to eq(422)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'can not create a post in a disallowed category' do
|
it 'can not create a post in a disallowed category' do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user