Skip to content

Commit 1b08454

Browse files
committed
Merge branch '08fastspec' of git://github.com/danielsdeleo/chef into danielsdeleo/08fastspec
2 parents 0cacde9 + 033a5e5 commit 1b08454

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

chef/lib/chef/client.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ def run_solo
114114
end
115115

116116
def run_ohai
117-
if @ohai.keys
118-
@ohai.refresh_plugins
117+
if ohai.keys
118+
ohai.refresh_plugins
119119
else
120-
@ohai.all_plugins
120+
ohai.all_plugins
121121
end
122122
end
123123

@@ -127,7 +127,7 @@ def determine_node_name
127127
if Chef::Config[:node_name]
128128
@node_name = Chef::Config[:node_name]
129129
else
130-
@node_name ||= @ohai[:fqdn] ? @ohai[:fqdn] : @ohai[:hostname]
130+
@node_name ||= ohai[:fqdn] ? ohai[:fqdn] : ohai[:hostname]
131131
Chef::Config[:node_name] = @node_name
132132
end
133133
@safe_name = @node_name.gsub(/\./, '_')

chef/spec/unit/client_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@
3737
to_stub.each do |method|
3838
@client.stub!(method).and_return(true)
3939
end
40+
41+
@mock_ohai = {
42+
:fqdn => "foo.bar.com",
43+
:hostname => "foo"
44+
}
45+
@mock_ohai.stub!(:refresh_plugins).and_return(true)
46+
Ohai::System.stub!(:new).and_return(@mock_ohai)
47+
48+
@client.stub!(:run_ohai)
49+
@client.stub!(:ohai).and_return(@mock_ohai)
50+
4051
time = Time.now
4152
Time.stub!(:now).and_return(time)
4253
Chef::Compile.stub!(:new).and_return(mock("Chef::Compile", :null_object => true))

0 commit comments

Comments
 (0)