Skip to content

Commit 0cbb1aa

Browse files
authored
test: cleanup tests (#101)
1 parent 56bedc6 commit 0cbb1aa

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

spec/channel_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ def loop_times(times)
3535
@channel.create(@random_user[:id])
3636
end
3737

38+
after(:each) do
39+
@client.delete_users(@random_users.map { |u| u[:id] } + [@random_user[:id]], user: StreamChat::HARD_DELETE, messages: StreamChat::HARD_DELETE)
40+
begin
41+
@channel.delete
42+
rescue StreamChat::StreamAPIException
43+
# if the channel is already deleted by the test, we can ignore the error
44+
end
45+
end
46+
3847
it 'can create channel without id' do
3948
channel = @client.channel('messaging', data: { 'members' => @random_users.map { |u| u[:id] } })
4049
expect(channel.id).to eq nil

spec/client_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ def loop_times(times)
4343
@client.upsert_users(@random_users)
4444
end
4545

46+
after(:each) do
47+
@client.delete_users(@random_users.map { |u| u[:id] } + [@random_user[:id]], user: StreamChat::HARD_DELETE, messages: StreamChat::HARD_DELETE)
48+
end
49+
4650
it 'properly sets up a new client' do
4751
client = StreamChat::Client.from_env
4852

0 commit comments

Comments
 (0)