diff options
author | John Keiser <jkeiser@opscode.com> | 2013-10-15 20:41:52 -0700 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-10-15 20:41:52 -0700 |
commit | e1c6bef68597f5c4f418107ef9e3638e44cc8cf7 (patch) | |
tree | c6871e3dcded48265f2b82c26ab13cd62a0ba2be /spec/unit/application_spec.rb | |
parent | 2da5abd0648f3ba6977d3a69d858078237bee585 (diff) | |
download | chef-e1c6bef68597f5c4f418107ef9e3638e44cc8cf7.tar.gz |
Add --config-file-jail to avoid loading user knife.rb in tests
Diffstat (limited to 'spec/unit/application_spec.rb')
-rw-r--r-- | spec/unit/application_spec.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index 9d473bbefb..e27a5cddb8 100644 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -108,12 +108,14 @@ describe Chef::Application do end it "should configure chef::config from a file" do + Chef::Application.should_receive(:config_file_exists?).with('/etc/chef/default.rb').and_return(true) File.should_receive(:open).with("/etc/chef/default.rb").and_yield(@config_file) Chef::Config.should_receive(:from_file).with(@config_file.path) @app.configure_chef end it "should merge the local config hash into chef::config" do + Chef::Application.should_receive(:config_file_exists?).with('/etc/chef/default.rb').and_return(true) File.should_receive(:open).with("/etc/chef/default.rb").and_yield(@config_file) @app.configure_chef Chef::Config.rspec_ran.should == "true" @@ -128,7 +130,7 @@ describe Chef::Application do it "should emit a warning" do Chef::Config.should_not_receive(:from_file).with("/etc/chef/default.rb") - Chef::Log.should_receive(:warn).with("No config file found or specified on command line, not loading.") + Chef::Log.should_receive(:warn).with("No config file found or specified on command line, using command line options.") @app.configure_chef end end @@ -164,6 +166,7 @@ describe Chef::Application do after {@config_file.unlink} it "should configure chef::config from an URL" do + Chef::Application.should_receive(:config_file_exists?).with('http://example.com/foo.rb').and_call_original Chef::REST.should_receive(:new).with("", nil, nil).at_least(1).times.and_return(@rest) @rest.should_receive(:fetch).with("http://example.com/foo.rb").and_yield(@config_file) @app.configure_chef |