|
5 | 5 |
|
6 | 6 | RSpec.describe Slack::Web::Api::Endpoints::Chat do |
7 | 7 | let(:client) { Slack::Web::Client.new } |
| 8 | + context 'chat_command' do |
| 9 | + it 'requires channel' do |
| 10 | + expect { client.chat_command(command: %q[/who]) }.to raise_error ArgumentError, /Required arguments :channel missing/ |
| 11 | + end |
| 12 | + it 'requires command' do |
| 13 | + expect { client.chat_command(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :command missing/ |
| 14 | + end |
| 15 | + end |
| 16 | + context 'chat_delete' do |
| 17 | + it 'requires channel' do |
| 18 | + expect { client.chat_delete(ts: %q["1405894322.002768"]) }.to raise_error ArgumentError, /Required arguments :channel missing/ |
| 19 | + end |
| 20 | + it 'requires ts' do |
| 21 | + expect { client.chat_delete(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :ts missing/ |
| 22 | + end |
| 23 | + end |
| 24 | + context 'chat_deleteScheduledMessage' do |
| 25 | + it 'requires channel' do |
| 26 | + expect { client.chat_deleteScheduledMessage(scheduled_message_id: %q[Q1234ABCD]) }.to raise_error ArgumentError, /Required arguments :channel missing/ |
| 27 | + end |
| 28 | + it 'requires scheduled_message_id' do |
| 29 | + expect { client.chat_deleteScheduledMessage(channel: %q[C123456789]) }.to raise_error ArgumentError, /Required arguments :scheduled_message_id missing/ |
| 30 | + end |
| 31 | + end |
| 32 | + context 'chat_getPermalink' do |
| 33 | + it 'requires channel' do |
| 34 | + expect { client.chat_getPermalink(message_ts: %q[1234567890.123456]) }.to raise_error ArgumentError, /Required arguments :channel missing/ |
| 35 | + end |
| 36 | + it 'requires message_ts' do |
| 37 | + expect { client.chat_getPermalink(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :message_ts missing/ |
| 38 | + end |
| 39 | + end |
| 40 | + context 'chat_meMessage' do |
| 41 | + it 'requires channel' do |
| 42 | + expect { client.chat_meMessage(text: %q[Hello world]) }.to raise_error ArgumentError, /Required arguments :channel missing/ |
| 43 | + end |
| 44 | + it 'requires text' do |
| 45 | + expect { client.chat_meMessage(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :text missing/ |
| 46 | + end |
| 47 | + end |
8 | 48 | context 'chat_postEphemeral' do |
| 49 | + it 'requires channel' do |
| 50 | + expect { client.chat_postEphemeral(user: %q[U0BPQUNTA], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]]) }.to raise_error ArgumentError, /Required arguments :channel missing/ |
| 51 | + end |
| 52 | + it 'requires user' do |
| 53 | + expect { client.chat_postEphemeral(channel: %q[C1234567890], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]]) }.to raise_error ArgumentError, /Required arguments :user missing/ |
| 54 | + end |
9 | 55 | it 'requires one of attachments, blocks, text' do |
10 | 56 | expect { client.chat_postEphemeral(channel: %q[C1234567890], user: %q[U0BPQUNTA]) }.to raise_error ArgumentError, /At least one of/ |
11 | 57 |
|
|
36 | 82 | end |
37 | 83 | end |
38 | 84 | context 'chat_postMessage' do |
| 85 | + it 'requires channel' do |
| 86 | + expect { client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]]) }.to raise_error ArgumentError, /Required arguments :channel missing/ |
| 87 | + end |
39 | 88 | it 'requires one of attachments, blocks, text' do |
40 | 89 | expect { client.chat_postMessage(channel: %q[C1234567890]) }.to raise_error ArgumentError, /At least one of/ |
41 | 90 |
|
|
66 | 115 | end |
67 | 116 | end |
68 | 117 | context 'chat_scheduleMessage' do |
| 118 | + it 'requires channel' do |
| 119 | + expect { client.chat_scheduleMessage(post_at: %q[299876400], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]]) }.to raise_error ArgumentError, /Required arguments :channel missing/ |
| 120 | + end |
| 121 | + it 'requires post_at' do |
| 122 | + expect { client.chat_scheduleMessage(channel: %q[C1234567890], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]]) }.to raise_error ArgumentError, /Required arguments :post_at missing/ |
| 123 | + end |
69 | 124 | it 'requires one of attachments, blocks, text' do |
70 | 125 | expect { client.chat_scheduleMessage(channel: %q[C1234567890], post_at: %q[299876400]) }.to raise_error ArgumentError, /At least one of/ |
71 | 126 |
|
|
96 | 151 | end |
97 | 152 | end |
98 | 153 | context 'chat_unfurl' do |
| 154 | + it 'requires channel' do |
| 155 | + expect { client.chat_unfurl(ts: %q[], unfurls: %q[]) }.to raise_error ArgumentError, /Required arguments :channel missing/ |
| 156 | + end |
| 157 | + it 'requires ts' do |
| 158 | + expect { client.chat_unfurl(channel: %q[C1234567890], unfurls: %q[]) }.to raise_error ArgumentError, /Required arguments :ts missing/ |
| 159 | + end |
| 160 | + it 'requires unfurls' do |
| 161 | + expect { client.chat_unfurl(channel: %q[C1234567890], ts: %q[]) }.to raise_error ArgumentError, /Required arguments :unfurls missing/ |
| 162 | + end |
99 | 163 | it 'encodes unfurls, user_auth_blocks as json' do |
100 | 164 | expect(client).to receive(:post).with('chat.unfurl', {channel: %q[C1234567890], ts: %q[], unfurls: %q[{"data":["data"]}], user_auth_blocks: %q[{"data":["data"]}]}) |
101 | 165 | client.chat_unfurl(channel: %q[C1234567890], ts: %q[], unfurls: {:data=>["data"]}, user_auth_blocks: {:data=>["data"]}) |
102 | 166 | end |
103 | 167 | end |
104 | 168 | context 'chat_update' do |
| 169 | + it 'requires channel' do |
| 170 | + expect { client.chat_update(ts: %q["1405894322.002768"], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]]) }.to raise_error ArgumentError, /Required arguments :channel missing/ |
| 171 | + end |
| 172 | + it 'requires ts' do |
| 173 | + expect { client.chat_update(channel: %q[C1234567890], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]]) }.to raise_error ArgumentError, /Required arguments :ts missing/ |
| 174 | + end |
105 | 175 | it 'requires one of attachments, blocks, text' do |
106 | 176 | expect { client.chat_update(channel: %q[C1234567890], ts: %q["1405894322.002768"]) }.to raise_error ArgumentError, /At least one of/ |
107 | 177 |
|
|
0 commit comments