Sha256: 994538fe459a19b34d63cd484e3e92330add48a05e1121fca5795d1b1ca642b2

Contents?: true

Size: 1.59 KB

Versions: 15

Compression:

Stored size: 1.59 KB

Contents

require_relative "../base"

describe VagrantPlugins::Parallels::Driver::PD_9 do
  include_context "parallels"

  subject { VagrantPlugins::Parallels::Driver::Meta.new(uuid) }

  it_behaves_like "parallels desktop driver"

  describe "set_power_consumption_mode" do
    it "turns 'longer-battery-life' on" do
      subprocess.should_receive(:execute).
        with("prlctl", "set", uuid, "--longer-battery-life", "on",
             an_instance_of(Hash)).
        and_return(subprocess_result(exit_code: 0))

      subject.set_power_consumption_mode(true)
    end

    it "turns 'longer-battery-life' off" do
      subprocess.should_receive(:execute).
        with("prlctl", "set", uuid, "--longer-battery-life", "off",
             an_instance_of(Hash)).
        and_return(subprocess_result(exit_code: 0))

      subject.set_power_consumption_mode(false)
    end
  end

  describe "ssh_ip" do
    let(:content) {'10.200.0.99="1394547632,1800,001c420000ff,01001c420000ff"'}

    it "returns an IP address assigned to the specified MAC" do
      driver.should_receive(:read_mac_address).and_return("001C420000FF")
      File.should_receive(:open).with(an_instance_of(String)).
        and_return(StringIO.new(content))

      subject.ssh_ip.should == "10.200.0.99"
    end

    it "rises DhcpLeasesNotAccessible exception when file is not accessible" do
      File.stub(:open).and_call_original
      File.should_receive(:open).with(an_instance_of(String)).
        and_raise(Errno::EACCES)
      expect { subject.ssh_ip }.
        to raise_error(VagrantPlugins::Parallels::Errors::DhcpLeasesNotAccessible)
    end
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
vagrant-parallels-1.4.0.rc1 test/unit/driver/pd_9_test.rb
vagrant-parallels-1.3.13 test/unit/driver/pd_9_test.rb
vagrant-parallels-1.3.12 test/unit/driver/pd_9_test.rb
vagrant-parallels-1.3.10 test/unit/driver/pd_9_test.rb
vagrant-parallels-1.3.9 test/unit/driver/pd_9_test.rb
vagrant-parallels-1.3.8 test/unit/driver/pd_9_test.rb
vagrant-parallels-1.3.7 test/unit/driver/pd_9_test.rb
vagrant-parallels-1.3.6 test/unit/driver/pd_9_test.rb
vagrant-parallels-1.3.5 test/unit/driver/pd_9_test.rb
vagrant-parallels-1.3.4 test/unit/driver/pd_9_test.rb
vagrant-parallels-1.3.3 test/unit/driver/pd_9_test.rb
vagrant-parallels-1.3.3.rc1 test/unit/driver/pd_9_test.rb
vagrant-parallels-1.3.2 test/unit/driver/pd_9_test.rb
vagrant-parallels-1.3.1 test/unit/driver/pd_9_test.rb
vagrant-parallels-1.3.0 test/unit/driver/pd_9_test.rb