Sha256: 605469d56752d01ad82fc0a3b76c8786f5c588e2651d2e77429157263155d118
Contents?: true
Size: 843 Bytes
Versions: 8
Compression:
Stored size: 843 Bytes
Contents
require 'spec_helper' share_examples_for :stoppable do after(:each) do subject.stop end context 'stopping' do it 'raises an exception when #before_stop does not receive a block' do expect { subject.before_stop }.to raise_error(ArgumentError) end it 'raises an exception if #before_stop is called more than once' do subject.before_stop{ nil } expect { subject.before_stop{ nil } }.to raise_error(Concurrent::Runnable::LifecycleError) end it 'returns self from #before_stop' do task = subject task.before_stop{ nil }.should eq task end it 'calls the #before_stop block when stopping' do @expected = false subject.before_stop{ @expected = true } subject.stop sleep(0.1) @expected.should be_true end end end
Version data entries
8 entries across 8 versions & 1 rubygems