mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 01:56:58 +08:00
Fix all the errors to get our tests green on Rails 5.1.
This commit is contained in:
@ -14,17 +14,20 @@ describe Admin::WebHooksController do
|
||||
|
||||
describe '#create' do
|
||||
it 'creates a webhook' do
|
||||
xhr :post, :create, web_hook: {
|
||||
payload_url: 'https://meta.discourse.org/',
|
||||
content_type: 1,
|
||||
secret: "a_secret_for_webhooks",
|
||||
wildcard_web_hook: false,
|
||||
active: true,
|
||||
verify_certificate: true,
|
||||
web_hook_event_type_ids: [1],
|
||||
group_ids: [],
|
||||
category_ids: []
|
||||
}
|
||||
post :create, params: {
|
||||
web_hook: {
|
||||
payload_url: 'https://meta.discourse.org/',
|
||||
content_type: 1,
|
||||
secret: "a_secret_for_webhooks",
|
||||
wildcard_web_hook: false,
|
||||
active: true,
|
||||
verify_certificate: true,
|
||||
web_hook_event_type_ids: [1],
|
||||
group_ids: [],
|
||||
category_ids: []
|
||||
}
|
||||
}, format: :json
|
||||
|
||||
expect(response).to be_success
|
||||
|
||||
json = ::JSON.parse(response.body)
|
||||
@ -32,16 +35,19 @@ describe Admin::WebHooksController do
|
||||
end
|
||||
|
||||
it 'returns error when field is not filled correctly' do
|
||||
xhr :post, :create, web_hook: {
|
||||
content_type: 1,
|
||||
secret: "a_secret_for_webhooks",
|
||||
wildcard_web_hook: false,
|
||||
active: true,
|
||||
verify_certificate: true,
|
||||
web_hook_event_type_ids: [1],
|
||||
group_ids: [],
|
||||
category_ids: []
|
||||
}
|
||||
post :create, params: {
|
||||
web_hook: {
|
||||
content_type: 1,
|
||||
secret: "a_secret_for_webhooks",
|
||||
wildcard_web_hook: false,
|
||||
active: true,
|
||||
verify_certificate: true,
|
||||
web_hook_event_type_ids: [1],
|
||||
group_ids: [],
|
||||
category_ids: []
|
||||
}
|
||||
}, format: :json
|
||||
|
||||
expect(response.status).to eq 422
|
||||
response_body = JSON.parse(response.body)
|
||||
|
||||
@ -53,7 +59,8 @@ describe Admin::WebHooksController do
|
||||
it 'enqueues the ping event' do
|
||||
Jobs.expects(:enqueue)
|
||||
.with(:emit_web_hook_event, web_hook_id: web_hook.id, event_type: 'ping', event_name: 'ping')
|
||||
xhr :post, :ping, id: web_hook.id
|
||||
|
||||
post :ping, params: { id: web_hook.id }, format: :json
|
||||
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
Reference in New Issue
Block a user