|
218 | 218 | expect(resp['results'].length).to eq(1) |
219 | 219 | end |
220 | 220 |
|
221 | | - describe 'blocklist' do |
| 221 | + describe 'blocklist', if: ENV['BLOCKLIST'] != 'false' do |
222 | 222 | before(:all) do |
223 | 223 | @blocklist = SecureRandom.uuid |
224 | | - @client.create_channel_type({ name: @blocklist }) |
225 | | - @blocklist_channel = @client.channel(@blocklist, channel_id: SecureRandom.uuid) |
226 | | - @blocklist_channel.create(@fellowship_of_the_ring[0][:id]) |
227 | | - end |
228 | | - |
229 | | - after(:all) do |
230 | | - @blocklist_channel.delete |
231 | | - @client.delete_channel_type(@blocklist) |
232 | 224 | end |
233 | 225 |
|
234 | 226 | it 'list available blocklists' do |
|
273 | 265 | end |
274 | 266 |
|
275 | 267 | it 'use the blocklist for a channel type' do |
276 | | - @client.update_channel_type(@blocklist, blocklist: @blocklist, blocklist_behavior: 'block') |
| 268 | + @client.update_channel_type('team', blocklist: @blocklist, blocklist_behavior: 'block') |
277 | 269 | end |
278 | 270 |
|
279 | 271 | xit 'should block messages that match the blocklist' do |
280 | | - resp = @blocklist_channel.send_message({ text: 'put some sugar and fudge on that!' }, @random_user[:id]) |
| 272 | + resp = @channel.send_message({ text: 'put some sugar and fudge on that!' }, @random_user[:id]) |
281 | 273 | expect(resp['message']['text']).to eq 'Automod blocked your message' |
282 | 274 | expect(resp['message']['type']).to eq 'error' |
283 | 275 | end |
|
287 | 279 | end |
288 | 280 |
|
289 | 281 | xit 'should block messages that match the blocklist again' do |
290 | | - resp = @blocklist_channel.send_message({ text: 'you should add more jam there ;)' }, @random_user[:id]) |
| 282 | + resp = @channel.send_message({ text: 'you should add more jam there ;)' }, @random_user[:id]) |
291 | 283 | expect(resp['message']['text']).to eq 'Automod blocked your message' |
292 | 284 | expect(resp['message']['type']).to eq 'error' |
293 | 285 | end |
|
297 | 289 | end |
298 | 290 |
|
299 | 291 | it 'should not block messages anymore' do |
300 | | - resp = @blocklist_channel.send_message({ text: 'put some sugar and fudge on that!' }, @random_user[:id]) |
| 292 | + resp = @channel.send_message({ text: 'put some sugar and fudge on that!' }, @random_user[:id]) |
301 | 293 | puts resp |
302 | 294 | expect(resp['message']['text']).to eq 'put some sugar and fudge on that!' |
303 | 295 | end |
|
0 commit comments