Skip to content

Commit ab4d85d

Browse files
committed
add test code
1 parent b24e724 commit ab4d85d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

spec/line/bot/rich_menu_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,22 @@
9595
expect(response.body).to eq '{"richMenuId":"7654321"}'
9696
end
9797

98+
it 'set a default rich menu' do
99+
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/user/all/richmenu/7654321'
100+
stub_request(:post, uri_template).to_return(body: '{}', status: 200)
101+
102+
client.set_default_rich_menu('7654321')
103+
expect(WebMock).to have_requested(:post, Line::Bot::API::DEFAULT_ENDPOINT + '/bot/user/all/richmenu/7654321')
104+
end
105+
106+
it 'unset a default rich menu' do
107+
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/user/all/richmenu'
108+
stub_request(:delete, uri_template).to_return(body: '{}', status: 200)
109+
110+
client.unset_default_rich_menu()
111+
expect(WebMock).to have_requested(:delete, Line::Bot::API::DEFAULT_ENDPOINT + '/bot/user/all/richmenu')
112+
end
113+
98114
it 'links a rich menu to a user' do
99115
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/user/1234567/richmenu/7654321'
100116
stub_request(:post, uri_template).to_return(body: '{}', status: 200)

0 commit comments

Comments
 (0)