summaryrefslogtreecommitdiff
path: root/spec/unit/plugins/darwin/hostname_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/plugins/darwin/hostname_spec.rb')
-rw-r--r--spec/unit/plugins/darwin/hostname_spec.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/spec/unit/plugins/darwin/hostname_spec.rb b/spec/unit/plugins/darwin/hostname_spec.rb
index 831781a3..e16c758a 100644
--- a/spec/unit/plugins/darwin/hostname_spec.rb
+++ b/spec/unit/plugins/darwin/hostname_spec.rb
@@ -22,14 +22,13 @@ describe Ohai::System, "Darwin hostname plugin" do
before do
@plugin = get_plugin("hostname")
allow(@plugin).to receive(:collect_os).and_return(:darwin)
- allow(@plugin).to receive(:shell_out).with("hostname -s").and_return(mock_shell_out(0, "katie", ""))
- allow(@plugin).to receive(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie.local", ""))
+ allow(@plugin).to receive(:shell_out).with("scutil --get HostName").and_return(mock_shell_out(0, "katie", ""))
+ allow(@plugin).to receive(:shell_out).with("scutil --get ComputerName").and_return(mock_shell_out(0, "katie.local", ""))
allow(@plugin).to receive(:resolve_fqdn).and_return("katie.bethell")
end
- it_should_check_from("darwin::hostname", "hostname", "hostname -s", "katie")
-
- it_should_check_from("linux::hostname", "machinename", "hostname", "katie.local")
+ it_should_check_from("darwin::hostname", "hostname", "scutil --get HostName", "katie")
+ it_should_check_from("darwin::hostname", "machinename", "scutil --get ComputerName", "katie.local")
it "uses #resolve_fqdn to find the fqdn" do
@plugin.run