|
10 | 10 | SiteSetting.chat_integration_discord_enabled = true
|
11 | 11 | end
|
12 | 12 |
|
13 |
| - let(:chan1) { DiscourseChatIntegration::Channel.create!(provider: 'discord', data: { name: "Awesome Channel", webhook_url: 'https://discordapp.com/api/webhooks/1234/abcd' }) } |
| 13 | + let(:chan1) { DiscourseChatIntegration::Channel.create!(provider: 'discord', data: { name: "Awesome Channel", webhook_url: 'https://discord.com/api/webhooks/1234/abcd' }) } |
14 | 14 |
|
15 | 15 | it 'sends a webhook request' do
|
16 |
| - stub1 = stub_request(:post, 'https://discordapp.com/api/webhooks/1234/abcd?wait=true').to_return(status: 200) |
| 16 | + stub1 = stub_request(:post, 'https://discord.com/api/webhooks/1234/abcd?wait=true').to_return(status: 200) |
17 | 17 | described_class.trigger_notification(post, chan1, nil)
|
18 | 18 | expect(stub1).to have_been_requested.once
|
19 | 19 | end
|
20 | 20 |
|
21 | 21 | it 'includes the protocol in the avatar URL' do
|
22 |
| - stub1 = stub_request(:post, 'https://discordapp.com/api/webhooks/1234/abcd?wait=true') |
| 22 | + stub1 = stub_request(:post, 'https://discord.com/api/webhooks/1234/abcd?wait=true') |
23 | 23 | .with(body: hash_including(embeds: [hash_including(author: hash_including(url: /^https?:\/\//))]))
|
24 | 24 | .to_return(status: 200)
|
25 | 25 | described_class.trigger_notification(post, chan1, nil)
|
26 | 26 | expect(stub1).to have_been_requested.once
|
27 | 27 | end
|
28 | 28 |
|
29 | 29 | it 'handles errors correctly' do
|
30 |
| - stub1 = stub_request(:post, "https://discordapp.com/api/webhooks/1234/abcd?wait=true").to_return(status: 400) |
| 30 | + stub1 = stub_request(:post, "https://discord.com/api/webhooks/1234/abcd?wait=true").to_return(status: 400) |
31 | 31 | expect(stub1).to have_been_requested.times(0)
|
32 | 32 | expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(::DiscourseChatIntegration::ProviderError)
|
33 | 33 | expect(stub1).to have_been_requested.once
|
|
0 commit comments