Skip to content

Commit ae044c2

Browse files
authored
Run tests in one version if depends on app config (#38)
Multi version running is causing tests to fail if app config is changing.
1 parent ae38d4f commit ae044c2

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- env:
1919
STREAM_CHAT_API_KEY: ${{ secrets.STREAM_CHAT_API_KEY }}
2020
STREAM_CHAT_API_SECRET: ${{ secrets.STREAM_CHAT_API_SECRET }}
21+
BLOCKLIST: ${{ matrix.ruby == '2.7' }}
2122
run: |
2223
gem install bundler
2324
bundle install --jobs 4 --retry 3

spec/client_spec.rb

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,9 @@
218218
expect(resp['results'].length).to eq(1)
219219
end
220220

221-
describe 'blocklist' do
221+
describe 'blocklist', if: ENV['BLOCKLIST'] != 'false' do
222222
before(:all) do
223223
@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)
232224
end
233225

234226
it 'list available blocklists' do
@@ -273,11 +265,11 @@
273265
end
274266

275267
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')
277269
end
278270

279271
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])
281273
expect(resp['message']['text']).to eq 'Automod blocked your message'
282274
expect(resp['message']['type']).to eq 'error'
283275
end
@@ -287,7 +279,7 @@
287279
end
288280

289281
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])
291283
expect(resp['message']['text']).to eq 'Automod blocked your message'
292284
expect(resp['message']['type']).to eq 'error'
293285
end
@@ -297,7 +289,7 @@
297289
end
298290

299291
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])
301293
puts resp
302294
expect(resp['message']['text']).to eq 'put some sugar and fudge on that!'
303295
end

0 commit comments

Comments
 (0)