Sha256: 2f0bcf5a858769ec76b835b37f7330f92ac4a149f368d521bfa68d92f140f84d

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 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
    name = '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, name)
  end

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

Version data entries

1 entries across 1 versions & 1 rubygems

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