summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Shirinkin <fodojyko@gmail.com>2014-07-01 08:50:12 +0200
committerLamont Granquist <lamont@scriptkiddie.org>2014-09-10 14:31:33 -0700
commit34d5b0f413b71727066357896ba862181f435b34 (patch)
tree69d0a4edea90dad46f8ee2ca6ced038222048248
parent8ec8e4850f3c0222df965bfe34ac0fdf215c1d24 (diff)
downloadchef-34d5b0f413b71727066357896ba862181f435b34.tar.gz
unit test for secret file discovery
-rw-r--r--spec/unit/knife/core/bootstrap_context_spec.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb
index 064f8c5621..6427071a6b 100644
--- a/spec/unit/knife/core/bootstrap_context_spec.rb
+++ b/spec/unit/knife/core/bootstrap_context_spec.rb
@@ -119,7 +119,20 @@ EXPECTED
context "via config[:secret_file]" do
let(:chef_config) do
{
- :knife => {:secret_file => secret_file}
+ :knife => {:secret_file => secret_file}
+ }
+ end
+ it "reads the encrypted_data_bag_secret" do
+ bootstrap_context.encrypted_data_bag_secret.should eq IO.read(secret_file)
+ end
+ end
+
+ context "via config[:secret_file] with short home path" do
+ let(:chef_config) do
+ home_path = File.expand_path("~")
+ shorted_secret_file_path = secret_file.gsub(home_path, "~")
+ {
+ :knife => {:secret_file => shorted_secret_file_path}
}
end
it "reads the encrypted_data_bag_secret" do