Skip to content

Commit 3cd0c32

Browse files
committed
Fix tests for list_folder/longpoll
1 parent ed27e40 commit 3cd0c32

File tree

5 files changed

+136
-151
lines changed

5 files changed

+136
-151
lines changed

spec/endpoints/files/list_folder_longpoll_spec.rb

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
1+
require 'byebug'
2+
13
# frozen_string_literal: true
24
describe DropboxApi::Client, '#list_folder_longpoll' do
5+
let(:path_prefix) { DropboxScaffoldBuilder.prefix_for :list_folder_longpoll }
36
before :each do
47
@client = DropboxApi::Client.new
58
end
69

710
before :each do
811
VCR.use_cassette('list_folder_longpoll/list_folder') do
9-
@cursor = @client.list_folder('').cursor
12+
@cursor = @client.list_folder(path_prefix).cursor
1013
end
1114
end
1215

1316
it 'returns a ListFolderLongpollResult', cassette: 'list_folder_longpoll/success' do
14-
result = @client.list_folder_longpoll @cursor
17+
result = nil
18+
[
19+
Thread.new {
20+
result = @client.list_folder_longpoll @cursor
21+
},
22+
Thread.new {
23+
sleep 1 # make sure the other request had time to start
24+
@client.upload("#{path_prefix}/duck.txt", 'Quack!')
25+
}
26+
].each(&:join)
1527

1628
expect(result).to be_a(DropboxApi::Results::ListFolderLongpollResult)
17-
end
18-
19-
it "indicates if there're changes", cassette: 'list_folder_longpoll/success' do
20-
result = @client.list_folder_longpoll @cursor
21-
2229
expect(result.changes).to be_truthy
2330
end
2431

spec/fixtures/vcr_cassettes/list_folder_longpoll/list_folder.yml

Lines changed: 22 additions & 108 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/vcr_cassettes/list_folder_longpoll/reset.yml

Lines changed: 18 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)