Skip to content

Commit

Permalink
issue guard#533: subject.stop so thread cannot keep running and lead …
Browse files Browse the repository at this point in the history
…to raise_expired_test_double_error
  • Loading branch information
ColinDKelley committed Mar 21, 2021
1 parent c24d860 commit 1be47d5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions spec/lib/listen/adapter/linux_spec.rb
Expand Up @@ -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) { {} }
Expand All @@ -42,6 +46,10 @@
allow(config).to receive(:silencer).and_return(silencer)
end

after do
subject.stop
end

it 'starts by calling watch with default events' do
expect(fake_worker).to receive(:watch).with(*directories.map(&:to_s), *default_events)
subject.start
Expand All @@ -55,6 +63,7 @@
before do
fake_worker = double(:fake_worker_for_inotify_limit_message)
allow(fake_worker).to receive(:watch).and_raise(Errno::ENOSPC)
allow(fake_worker).to receive(:close)

fake_notifier = double(:fake_notifier, new: fake_worker)
stub_const('INotify::Notifier', fake_notifier)
Expand Down

0 comments on commit 1be47d5

Please sign in to comment.