summaryrefslogtreecommitdiff
path: root/spec/unit/knife_spec.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2014-09-02 11:48:13 -0700
committerdanielsdeleo <dan@getchef.com>2014-09-03 12:44:46 -0700
commiteffa8c560eef788d679f8af55f3af6eefaf619da (patch)
treed5344d88f3249b1e10e143c60c8d745091a5eaa2 /spec/unit/knife_spec.rb
parentd762b7ba7483378439737f14b9b8b3b1a9cb727e (diff)
downloadchef-effa8c560eef788d679f8af55f3af6eefaf619da.tar.gz
Extract Knife config file find/load to a reusable component
Diffstat (limited to 'spec/unit/knife_spec.rb')
-rw-r--r--spec/unit/knife_spec.rb33
1 files changed, 3 insertions, 30 deletions
diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb
index 70b60a2f96..2db6b40b28 100644
--- a/spec/unit/knife_spec.rb
+++ b/spec/unit/knife_spec.rb
@@ -44,34 +44,6 @@ describe Chef::Knife do
@stderr = StringIO.new
end
- describe "selecting a config file" do
- context "when the current working dir is inside a symlinked directory" do
- before do
- Chef::Knife.reset_config_path!
- # pwd according to your shell is /home/someuser/prod/chef-repo, but
- # chef-repo is a symlink to /home/someuser/codes/chef-repo
- if Chef::Platform.windows?
- ENV.should_receive(:[]).with("CD").and_return("/home/someuser/prod/chef-repo")
- else
- ENV.should_receive(:[]).with("PWD").and_return("/home/someuser/prod/chef-repo")
- end
-
- Dir.stub(:pwd).and_return("/home/someuser/codes/chef-repo")
- end
-
- after do
- Chef::Knife.reset_config_path!
- end
-
- it "loads the config from the non-dereferenced directory path" do
- File.should_receive(:exist?).with("/home/someuser/prod/chef-repo/.chef").and_return(false)
- File.should_receive(:exist?).with("/home/someuser/prod/.chef").and_return(true)
- File.should_receive(:directory?).with("/home/someuser/prod/.chef").and_return(true)
- Chef::Knife.chef_config_dir.should == "/home/someuser/prod/.chef"
- end
- end
- end
-
describe "after loading a subcommand" do
before do
Chef::Knife.reset_subcommands!
@@ -247,7 +219,7 @@ describe Chef::Knife do
end
it "loads lazy dependencies" do
- command = Chef::Knife.run(%w{test yourself})
+ Chef::Knife.run(%w{test yourself})
KnifeSpecs::TestYourself.test_deps_loaded.should be_true
end
@@ -256,7 +228,8 @@ describe Chef::Knife do
KnifeSpecs::TestYourself.class_eval do
deps { other_deps_loaded = true }
end
- command = Chef::Knife.run(%w{test yourself})
+
+ Chef::Knife.run(%w{test yourself})
KnifeSpecs::TestYourself.test_deps_loaded.should be_true
other_deps_loaded.should be_true
end