Skip to content

Commit

Permalink
Add test case for stuck fiber
Browse files Browse the repository at this point in the history
  • Loading branch information
rmosolgo committed Oct 27, 2022
1 parent 49b89c6 commit 8a32cff
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions spec/rspec/support/reentrant_mutex_spec.rb
Expand Up @@ -51,4 +51,29 @@
end
end
end

describe 'with mocked methods inside fibers' do
class ExampleClass
def self.do_something; true; end
end

subject(:mutation) do
f = Fiber.new do
ExampleClass.do_something
end
f.resume
end

let(:mocked_return_value) { 'something' }

before do
allow(ExampleClass).to receive(:do_something) do
mocked_return_value
end
end

it 'does not hang' do
expect(subject).to eq('something')
end
end
end

0 comments on commit 8a32cff

Please sign in to comment.