summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2015-05-26 12:47:33 -0700
committerdanielsdeleo <dan@getchef.com>2015-05-26 12:49:19 -0700
commit182f3760dd4d81033d57cfc4d36b2fb6fc848e32 (patch)
treee883881a527a13583785920b2882bef043d5639c
parent58410b2f1970fc17defefb39828f09b9489d79ec (diff)
downloadchef-182f3760dd4d81033d57cfc4d36b2fb6fc848e32.tar.gz
Test format_for_display when given keys don't exist at all
-rw-r--r--spec/unit/knife/core/ui_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/unit/knife/core/ui_spec.rb b/spec/unit/knife/core/ui_spec.rb
index 1fe46eb85b..ab420518a3 100644
--- a/spec/unit/knife/core/ui_spec.rb
+++ b/spec/unit/knife/core/ui_spec.rb
@@ -375,6 +375,13 @@ EOM
@ui.config[:attribute] = "name"
expect(@ui.format_for_display(input)).to eq( {"chef.localdomain"=>{"name"=>"chef.localdomain"} })
end
+
+ it "returns nil when given an attribute path that isn't a name or attribute" do
+ input = { "keys" => {"keys" => "values"}, "hi" => "ho", "id" => "sample-data-bag-item" }
+ non_existing_path = "nope.nada.nothingtoseehere"
+ @ui.config[:attribute] = non_existing_path
+ expect(@ui.format_for_display(input)).to eq({ "sample-data-bag-item" => { non_existing_path => nil } })
+ end
end
describe "with --run-list passed" do