Sha256: 09576133c392d75557beb60412d16d94c3a1e2f3534b07004bad9cd0d240dc96

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require 'vagrant-guests-solaris11/cap/change_host_name'
require 'spec_helper'

describe VagrantPlugins::GuestSolaris11::Cap::ChangeHostName do
  include_context 'machine'

  it "should change hostname when hostname is differ from current" do
    hostname = 'vagrant-solaris11'
    communicate.stub(:test).and_return(false)
    communicate.should_receive(:sudo).with("/usr/sbin/svccfg -s system/identity:node setprop config/nodename=\"#{name}\"")
    communicate.should_receive(:sudo).with("/usr/sbin/svccfg -s system/identity:node setprop config/loopback=\"#{name}\"")
    communicate.should_receive(:sudo).with("/usr/sbin/svccfg -s system/identity:node refresh ")
    communicate.should_receive(:sudo).with("/usr/sbin/svcadm restart system/identity:node ")
    described_class.change_host_name(machine, hostname)
  end

  it "should not change hostname when hostname equals current" do
    hostname = 'vagrant-solaris11'
    communicate.stub(:test).and_return(true)
    communicate.should_not_receive(:sudo)
    described_class.change_host_name(machine, hostname)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-guests-solaris11-0.0.1.dev spec/cap/change_host_name_spec.rb