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 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