Skip to content

Commit 87a47d8

Browse files
committed
add specs for files_upload_v2
1 parent 2338b38 commit 87a47d8

File tree

2 files changed

+266
-0
lines changed

2 files changed

+266
-0
lines changed

spec/fixtures/slack/web/files_upload_v2.yml

Lines changed: 222 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
require 'spec_helper'
2+
3+
RSpec.describe Slack::Web::Api::Endpoints::Files do
4+
let(:client) { Slack::Web::Client.new }
5+
let(:valid_params) do
6+
{ filename: 'test.txt', content: 'Test File Contents', channels: 'C08AZ76CA4V' }
7+
end
8+
9+
context 'when filename is missing from options' do
10+
before do
11+
valid_params.delete(:filename)
12+
end
13+
14+
it 'throws argument error' do
15+
expect { client.files_upload_v2(valid_params) }.to raise_error ArgumentError
16+
end
17+
end
18+
19+
context 'when channels is missing from options' do
20+
before do
21+
valid_params.delete(:channels)
22+
end
23+
24+
it 'throws argument error' do
25+
expect { client.files_upload_v2(valid_params) }.to raise_error ArgumentError
26+
end
27+
end
28+
29+
context 'when content is missing from options' do
30+
before do
31+
valid_params.delete(:content)
32+
end
33+
34+
it 'throws argument error' do
35+
expect { client.files_upload_v2(valid_params) }.to raise_error ArgumentError
36+
end
37+
end
38+
39+
context 'when all required options are sent', vcr: { cassette_name: 'web/files_upload_v2' } do
40+
it 'completes the upload' do
41+
client.files_upload_v2(valid_params)
42+
end
43+
end
44+
end

0 commit comments

Comments
 (0)