summaryrefslogtreecommitdiff
path: root/spec/mspec/spec/guards/block_device_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/mspec/spec/guards/block_device_spec.rb')
-rw-r--r--spec/mspec/spec/guards/block_device_spec.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/mspec/spec/guards/block_device_spec.rb b/spec/mspec/spec/guards/block_device_spec.rb
index 3b437b6d74..dd420d4a81 100644
--- a/spec/mspec/spec/guards/block_device_spec.rb
+++ b/spec/mspec/spec/guards/block_device_spec.rb
@@ -1,46 +1,46 @@
require 'spec_helper'
require 'mspec/guards'
-describe Object, "#with_block_device" do
+RSpec.describe Object, "#with_block_device" do
before :each do
ScratchPad.clear
@guard = BlockDeviceGuard.new
- BlockDeviceGuard.stub(:new).and_return(@guard)
+ allow(BlockDeviceGuard).to receive(:new).and_return(@guard)
end
platform_is_not :freebsd, :windows do
it "yields if block device is available" do
- @guard.should_receive(:`).and_return("block devices")
+ expect(@guard).to receive(:`).and_return("block devices")
with_block_device { ScratchPad.record :yield }
- ScratchPad.recorded.should == :yield
+ expect(ScratchPad.recorded).to eq(:yield)
end
it "does not yield if block device is not available" do
- @guard.should_receive(:`).and_return(nil)
+ expect(@guard).to receive(:`).and_return(nil)
with_block_device { ScratchPad.record :yield }
- ScratchPad.recorded.should_not == :yield
+ expect(ScratchPad.recorded).not_to eq(:yield)
end
end
platform_is :freebsd, :windows do
it "does not yield, since platform does not support block devices" do
- @guard.should_not_receive(:`)
+ expect(@guard).not_to receive(:`)
with_block_device { ScratchPad.record :yield }
- ScratchPad.recorded.should_not == :yield
+ expect(ScratchPad.recorded).not_to eq(:yield)
end
end
it "sets the name of the guard to :with_block_device" do
with_block_device { }
- @guard.name.should == :with_block_device
+ expect(@guard.name).to eq(:with_block_device)
end
it "calls #unregister even when an exception is raised in the guard block" do
- @guard.should_receive(:match?).and_return(true)
- @guard.should_receive(:unregister)
- lambda do
+ expect(@guard).to receive(:match?).and_return(true)
+ expect(@guard).to receive(:unregister)
+ expect do
with_block_device { raise Exception }
- end.should raise_error(Exception)
+ end.to raise_error(Exception)
end
end