File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ( /\. / , '_' )
Original file line number Diff line number Diff line change 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 ) )
You can’t perform that action at this time.
0 commit comments