Skip to content

Commit 1898e9a

Browse files
add set webhook endpoint test
1 parent 82dc716 commit 1898e9a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

spec/line/bot/webhook_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
}
1010
EOS
1111

12+
UPDATE_WEBHOOK_ENDPOINT = 'https://example.com/hoge'
13+
UPDATE_WEBHOOK_ENDPOINT_CONTENT = <<"EOS"
14+
{
15+
"endpoint": "#{UPDATE_WEBHOOK_ENDPOINT}"
16+
}
17+
EOS
18+
1219
describe Line::Bot::Client do
1320
let(:client) do
1421
dummy_config = {
@@ -31,4 +38,13 @@
3138
active: true
3239
)
3340
end
41+
42+
it 'set webhook endpoint' do
43+
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/channel/webhook/endpoint'
44+
stub_request(:put, uri_template).to_return(body: '{}', status: 200)
45+
46+
client.set_webhook_endpoint(UPDATE_WEBHOOK_ENDPOINT)
47+
expect(WebMock).to have_requested(:put, Line::Bot::API::DEFAULT_ENDPOINT + '/bot/channel/webhook/endpoint')
48+
.with(body: JSON.parse(UPDATE_WEBHOOK_ENDPOINT_CONTENT).to_json)
49+
end
3450
end

0 commit comments

Comments
 (0)