summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2018-06-24 00:11:47 -0700
committerNoah Kantrowitz <noah@coderanger.net>2018-06-24 00:11:47 -0700
commite0230f1a74ad91d56b12d1ccbbdf5494dda22aa1 (patch)
treea5a50762023ee4f253e49e8fb207cb9637b2607c
parent79fc2d7ecf5b6a3248bbc22e37d9374d78359fb9 (diff)
downloadchef-e0230f1a74ad91d56b12d1ccbbdf5494dda22aa1.tar.gz
Apparently the block argument is already in use with `knife()` even though I can't figure out quite how.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
-rw-r--r--spec/integration/knife/config_spec.rb4
-rw-r--r--spec/support/shared/integration/knife_support.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/spec/integration/knife/config_spec.rb b/spec/integration/knife/config_spec.rb
index efde46c69d..506db73e4c 100644
--- a/spec/integration/knife/config_spec.rb
+++ b/spec/integration/knife/config_spec.rb
@@ -30,14 +30,14 @@ describe "knife config", :workstation do
let(:cmd_args) { [] }
subject do
- cmd = knife("config", *cmd_args) do |instance|
+ cmd = knife("config", *cmd_args, instance_filter: lambda { |instance|
# Clear the stub set up in KnifeSupport.
allow(File).to receive(:file?).and_call_original
# Lies, damn lies, and config files. We need to allow normal config loading
# behavior to be able to test stuff.
instance.config.delete(:config_file)
$__KNIFE_INTEGRATION_FAILSAFE_CHECK << " ole"
- end
+ })
cmd.stdout
end
diff --git a/spec/support/shared/integration/knife_support.rb b/spec/support/shared/integration/knife_support.rb
index 0a0d2d0c0c..fae35f27f4 100644
--- a/spec/support/shared/integration/knife_support.rb
+++ b/spec/support/shared/integration/knife_support.rb
@@ -24,7 +24,7 @@ require "chef/chef_fs/file_system_cache"
module KnifeSupport
DEBUG = ENV["DEBUG"]
- def knife(*args, input: nil, &block)
+ def knife(*args, input: nil, instance_filter: nil)
# Allow knife('role from file roles/blah.json') rather than requiring the
# arguments to be split like knife('role', 'from', 'file', 'roles/blah.json')
# If any argument will have actual spaces in it, the long form is required.
@@ -92,7 +92,7 @@ module KnifeSupport
$__KNIFE_INTEGRATION_FAILSAFE_CHECK = "ole"
# Allow tweaking the knife instance before configuration.
- yield(instance) if block
+ instance_filter.call(instance) if instance_filter
instance.configure_chef