Sha256: 8ee32e516d91ca6c9667158873a47c36f34d4679c61fd06a172d1f1b2df28901
Contents?: true
Size: 1.56 KB
Versions: 3
Compression:
Stored size: 1.56 KB
Contents
require 'vcr/library_hooks' module VCR describe LibraryHooks do describe '#disabled?' do it 'returns false by default for any argument given' do expect(subject.disabled?(:foo)).to be_false expect(subject.disabled?(:bar)).to be_false end context 'when a library hook is exclusively enabled' do it 'returns false for the exclusively enabled hook' do faraday_disabled = nil subject.exclusively_enabled :faraday do faraday_disabled = subject.disabled?(:faraday) end expect(faraday_disabled).to eq(false) end it 'returns true for every other argument given' do foo_disabled = bar_disabled = nil subject.exclusively_enabled :faraday do foo_disabled = subject.disabled?(:foo) bar_disabled = subject.disabled?(:bar) end expect(foo_disabled).to be_true expect(bar_disabled).to be_true end end end describe '#exclusively_enabled' do it 'restores all hook to being enabled when the block completes' do subject.exclusively_enabled(:faraday) { } expect(subject.disabled?(:foo)).to be_false expect(subject.disabled?(:faraday)).to be_false end it 'restores all hooks to being enabled when the block completes, even if there is an error' do subject.exclusively_enabled(:faraday) { raise "boom" } rescue expect(subject.disabled?(:foo)).to be_false expect(subject.disabled?(:faraday)).to be_false end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vcr-2.7.0 | spec/vcr/library_hooks_spec.rb |
vcr-2.6.0 | spec/vcr/library_hooks_spec.rb |
vcr-2.5.0 | spec/vcr/library_hooks_spec.rb |