From 9534f7b285aa911813238ee898b5d28c088dbbdc Mon Sep 17 00:00:00 2001 From: Joe Rafaniello Date: Mon, 12 Aug 2013 17:15:31 -0400 Subject: [PATCH 1/2] Remove deprecation warnings. --- spec/common_spec.rb | 2 +- spec/distro_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/common_spec.rb b/spec/common_spec.rb index 6cde9ec..3515d07 100644 --- a/spec/common_spec.rb +++ b/spec/common_spec.rb @@ -35,7 +35,7 @@ class TestClass context ".cmd" do it "looks up local command from id" do - d = stub(LinuxAdmin::Distro) + d = double(LinuxAdmin::Distro) d.class::COMMANDS = { :sh => '/bin/sh' } LinuxAdmin::Distro.should_receive(:local).and_return(d) subject.cmd(:sh).should == '/bin/sh' diff --git a/spec/distro_spec.rb b/spec/distro_spec.rb index fd404ef..83aa080 100644 --- a/spec/distro_spec.rb +++ b/spec/distro_spec.rb @@ -45,7 +45,7 @@ end it "returns Distros.generic" do - File.stub!(:exists?).and_return(false) + File.stub(:exists?).and_return(false) LinuxAdmin::Distro.local.should == LinuxAdmin::Distros.generic end end From 0a2751ce9fd99241662fe7936964fc2f4158950b Mon Sep 17 00:00:00 2001 From: Joe Rafaniello Date: Mon, 12 Aug 2013 17:26:06 -0400 Subject: [PATCH 2/2] Stub Disk#size to prevent shelling out on PhysicalVolume.create Resolves "No such file or directory - /sbin/fdisk -l" failures on a Mac. --- spec/physical_volume_spec.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/physical_volume_spec.rb b/spec/physical_volume_spec.rb index 27ad66f..3862ff9 100644 --- a/spec/physical_volume_spec.rb +++ b/spec/physical_volume_spec.rb @@ -47,8 +47,14 @@ end describe "#create" do + before do + @disk = LinuxAdmin::Disk.new :path => '/dev/hda' + @disk.stub(:size) + end + + let(:disk) {@disk} + it "uses pvcreate" do - disk = LinuxAdmin::Disk.new :path => '/dev/hda' described_class.instance_variable_set(:@pvs, []) described_class.should_receive(:run). with(LinuxAdmin.cmd(:pvcreate), @@ -57,7 +63,6 @@ end it "returns new physical volume" do - disk = LinuxAdmin::Disk.new :path => '/dev/hda' LinuxAdmin::VolumeGroup.stub(:run => "") described_class.stub(:run => "") pv = described_class.create disk @@ -66,7 +71,6 @@ end it "adds physical volume to local registry" do - disk = LinuxAdmin::Disk.new :path => '/dev/hda' LinuxAdmin::VolumeGroup.stub(:run => "") described_class.stub(:run => "") pv = described_class.create disk