Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/daemon_spec.rb')
-rw-r--r--spec/lib/gitlab/daemon_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/lib/gitlab/daemon_spec.rb b/spec/lib/gitlab/daemon_spec.rb
index 075a1e414c7..4d11b0bdc6c 100644
--- a/spec/lib/gitlab/daemon_spec.rb
+++ b/spec/lib/gitlab/daemon_spec.rb
@@ -46,6 +46,30 @@ RSpec.describe Gitlab::Daemon do
expect(subject).to have_received(:run_thread)
end
+
+ context '@synchronous' do
+ context 'when @synchronous is set to true' do
+ subject { described_class.instance(synchronous: true) }
+
+ it 'calls join on the thread' do
+ # Thread has to be run in a block, expect_next_instance_of does not support this.
+ expect_any_instance_of(Thread).to receive(:join) # rubocop:disable RSpec/AnyInstanceOf
+
+ subject.start
+ end
+ end
+
+ context 'when @synchronous is not set to a truthy value' do
+ subject { described_class.instance }
+
+ it 'does not call join on the thread' do
+ # Thread has to be run in a block, expect_next_instance_of does not support this.
+ expect_any_instance_of(Thread).not_to receive(:join) # rubocop:disable RSpec/AnyInstanceOf
+
+ subject.start
+ end
+ end
+ end
end
describe '#stop' do