File tree Expand file tree Collapse file tree 2 files changed +34
-21
lines changed Expand file tree Collapse file tree 2 files changed +34
-21
lines changed Original file line number Diff line number Diff line change 200
200
}
201
201
EOS
202
202
203
- WEBHOOK_ENDPOINT_CONTENT = <<"EOS"
204
- {
205
- "endpoint": "https://example.com/test",
206
- "active": true
207
- }
208
- EOS
209
-
210
203
describe Line ::Bot ::Client do
211
204
before do
212
205
end
@@ -487,18 +480,4 @@ def generate_client
487
480
markAsReadMode : 'manual'
488
481
)
489
482
end
490
-
491
- it 'get webhook endpoint' do
492
- uri_template = Addressable ::Template . new Line ::Bot ::API ::DEFAULT_ENDPOINT + '/bot/channel/webhook/endpoint'
493
- stub_request ( :get , uri_template ) . to_return ( body : WEBHOOK_ENDPOINT_CONTENT , status : 200 )
494
-
495
- client = generate_client
496
- response = client . get_webhook_endpoint
497
-
498
- json = JSON . parse ( response . body , symbolize_names : true )
499
- expect ( json ) . to eq (
500
- endpoint : 'https://example.com/test' ,
501
- active : true
502
- )
503
- end
504
483
end
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+ require 'webmock/rspec'
3
+ require 'json'
4
+
5
+ WEBHOOK_ENDPOINT_CONTENT = <<"EOS"
6
+ {
7
+ "endpoint": "https://example.com/test",
8
+ "active": true
9
+ }
10
+ EOS
11
+
12
+ describe Line ::Bot ::Client do
13
+ let ( :client ) do
14
+ dummy_config = {
15
+ channel_token : 'access token' ,
16
+ }
17
+ Line ::Bot ::Client . new do |config |
18
+ config . channel_token = dummy_config [ :channel_token ]
19
+ end
20
+ end
21
+
22
+ it 'get webhook endpoint' do
23
+ uri_template = Addressable ::Template . new Line ::Bot ::API ::DEFAULT_ENDPOINT + '/bot/channel/webhook/endpoint'
24
+ stub_request ( :get , uri_template ) . to_return ( body : WEBHOOK_ENDPOINT_CONTENT , status : 200 )
25
+
26
+ response = client . get_webhook_endpoint
27
+
28
+ json = JSON . parse ( response . body , symbolize_names : true )
29
+ expect ( json ) . to eq (
30
+ endpoint : 'https://example.com/test' ,
31
+ active : true
32
+ )
33
+ end
34
+ end
You can’t perform that action at this time.
0 commit comments