|
42 | 42 | WebMock.allow_net_connect! |
43 | 43 |
|
44 | 44 | describe Line::Bot::Client do |
45 | | - let(:client) { |
| 45 | + let(:client) do |
46 | 46 | dummy_config = { |
47 | 47 | channel_token: 'access token', |
48 | 48 | } |
49 | 49 | Line::Bot::Client.new do |config| |
50 | 50 | config.channel_token = dummy_config[:channel_token] |
51 | 51 | end |
52 | | - } |
| 52 | + end |
53 | 53 |
|
54 | 54 | it 'gets a list of rich menus' do |
55 | 55 | uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/list' |
|
164 | 164 | it 'uploads and attaches an image to a rich menu' do |
165 | 165 | uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/1234567/content' |
166 | 166 |
|
167 | | - stub_request(:post, uri_template).to_return(body: '{}', status: 200).with { |request| |
| 167 | + stub_request(:post, uri_template).to_return(body: '{}', status: 200).with do |request| |
168 | 168 | expect(request.headers["Content-Type"]).to eq('image/png') |
169 | | - } |
| 169 | + end |
170 | 170 |
|
171 | 171 | File.open(RICH_MENU_IMAGE_FILE_PATH) do |image_file| |
172 | 172 | client.create_rich_menu_image('1234567', image_file) |
|
179 | 179 | it "uploads invalid extension's file" do |
180 | 180 | uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/1234567/content' |
181 | 181 | stub_request(:post, uri_template).to_return(body: '{}', status: 200) |
182 | | - expect { |
| 182 | + expect do |
183 | 183 | File.open(RICH_MENU_INVALID_FILE_EXTENSION_PATH) do |file| |
184 | 184 | client.create_rich_menu_image('1234567', file) |
185 | 185 | end |
186 | | - }.to raise_error(ArgumentError) |
| 186 | + end.to raise_error(ArgumentError) |
187 | 187 | end |
188 | 188 | end |
0 commit comments