Sha256: c087f79623c4e856350a9d043670d006f245fc7326998d2ca0cffdc78184bf7c
Contents?: true
Size: 1.44 KB
Versions: 17
Compression:
Stored size: 1.44 KB
Contents
require_relative "../../../../base" describe "VagrantPlugins::GuestSmartos::Cap::ChangeHostName" do let(:caps) do VagrantPlugins::GuestSmartos::Plugin .components .guest_capabilities[:smartos] end let(:machine) { double("machine") } let(:comm) { VagrantTests::DummyCommunicator::Communicator.new(machine) } let(:config) { double("config", smartos: VagrantPlugins::GuestSmartos::Config.new) } before do allow(machine).to receive(:communicate).and_return(comm) allow(machine).to receive(:config).and_return(config) end after do comm.verify_expectations! end describe ".change_host_name" do let(:cap) { caps.get(:change_host_name) } it "changes the hostname if appropriate" do cap.change_host_name(machine, "testhost") expect(comm.received_commands[0]).to match(/if hostname | grep 'testhost' ; then/) expect(comm.received_commands[0]).to match(/exit 0/) expect(comm.received_commands[0]).to match(/fi/) expect(comm.received_commands[0]).to match(/if \[ -d \/usbkey \] && \[ "\$\(zonename\)" == "global" \] ; then/) expect(comm.received_commands[0]).to match(/pfexec sed -i '' 's\/hostname=\.\*\/hostname=testhost\/' \/usbkey\/config/) expect(comm.received_commands[0]).to match(/fi/) expect(comm.received_commands[0]).to match(/pfexec echo 'testhost' > \/etc\/nodename/) expect(comm.received_commands[0]).to match(/pfexec hostname testhost/) end end end
Version data entries
17 entries across 13 versions & 5 rubygems