From 82e7bc2eab34c09ec65c4cb49465200a17747c0c Mon Sep 17 00:00:00 2001 From: Colin Kelley Date: Sat, 20 Mar 2021 17:23:05 -0700 Subject: [PATCH] issue #533: subject.stop so thread cannot keep running and lead to raise_expired_test_double_error --- spec/lib/listen/adapter/linux_spec.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spec/lib/listen/adapter/linux_spec.rb b/spec/lib/listen/adapter/linux_spec.rb index d87b65ff..13d2a257 100644 --- a/spec/lib/listen/adapter/linux_spec.rb +++ b/spec/lib/listen/adapter/linux_spec.rb @@ -26,6 +26,10 @@ # TODO: fix other adapters too! subject { described_class.new(config) } + after do + subject.stop + end + describe 'watch events' do let(:directories) { [Pathname.pwd] } let(:adapter_options) { {} } @@ -40,6 +44,11 @@ allow(config).to receive(:adapter_options).and_return(adapter_options) allow(config).to receive(:queue).and_return(queue) allow(config).to receive(:silencer).and_return(silencer) + allow(fake_worker).to receive(:close) + end + + after do + subject.stop end it 'starts by calling watch with default events' do @@ -168,7 +177,6 @@ end it 'stops the worker' do - expect(fake_worker).to receive(:close) subject.stop end end