spec/mountable_spec.rb in linux_admin-1.0.1 vs spec/mountable_spec.rb in linux_admin-1.1.0

- old
+ new

@@ -35,21 +35,37 @@ .and_return(double(:output => "")) TestMountable.mount_point_exists?('/mnt/usb') end context "disk mounted at specified location" do - it "returns true" do + before do expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @mount_out1)) + end + + it "returns true" do expect(TestMountable.mount_point_exists?('/mnt/usb')).to be_truthy end + + it "returns true when using a pathname" do + path = Pathname.new("/mnt/usb") + expect(TestMountable.mount_point_exists?(path)).to be_truthy + end end context "no disk mounted at specified location" do - it "returns false" do + before do expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @mount_out2)) + end + + it "returns false" do expect(TestMountable.mount_point_exists?('/mnt/usb')).to be_falsey end + + it "returns false when using a pathname" do + path = Pathname.new("/mnt/usb") + expect(TestMountable.mount_point_exists?(path)).to be_falsey + end end end describe "#mount_point_available?" do it "uses mount" do @@ -57,19 +73,35 @@ .and_return(double(:output => "")) TestMountable.mount_point_available?('/mnt/usb') end context "disk mounted at specified location" do - it "returns false" do + before do expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @mount_out1)) + end + + it "returns false" do expect(TestMountable.mount_point_available?('/mnt/usb')).to be_falsey end + + it "returns false when using a pathname" do + path = Pathname.new("/mnt/usb") + expect(TestMountable.mount_point_available?(path)).to be_falsey + end end context "no disk mounted at specified location" do - it "returns true" do + before do expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @mount_out2)) + end + + it "returns true" do expect(TestMountable.mount_point_available?('/mnt/usb')).to be_truthy + end + + it "returns true when using a pathname" do + path = Pathname.new("/mnt/usb") + expect(TestMountable.mount_point_available?(path)).to be_truthy end end end describe "#discover_mount_point" do