spec/unit/plugins/hostname_spec.rb in ohai-7.4.1 vs spec/unit/plugins/hostname_spec.rb in ohai-7.6.0.rc.0
- old
+ new
@@ -70,9 +70,21 @@
@plugin.run
@plugin[:hostname].should == "katie"
end
end
+ context "when a system has a bare hostname without a FQDN" do
+ before(:each) do
+ @plugin.stub(:collect_os).and_return(:default)
+ @plugin.stub(:shell_out).with("hostname").and_return(mock_shell_out(0, "katie", ""))
+ end
+
+ it "should correctly set the [short] hostname" do
+ @plugin.run
+ @plugin[:hostname].should == "katie"
+ end
+ end
+
context "hostname --fqdn when it returns empty string" do
before(:each) do
@plugin.stub(:collect_os).and_return(:linux)
@plugin.stub(:shell_out).with("hostname -s").and_return(
mock_shell_out(0, "katie", ""))