summaryrefslogtreecommitdiff
path: root/spec/support/shared
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2020-04-03 16:01:17 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2020-04-03 16:01:17 -0700
commit87c66a075c21f28cbbe9e1bee64f9b0f3c36fcfc (patch)
treea280f61eca7004376b5e1f70535553c2a6293af8 /spec/support/shared
parentb38fd9279841c61e09926a85f9ba90b3313cdd0c (diff)
downloadchef-87c66a075c21f28cbbe9e1bee64f9b0f3c36fcfc.tar.gz
Implement eager_load_libraries metadata option
This implements RFC-40 from the old chef rfc repo: https://github.com/chef-boneyard/chef-rfc/blob/master/rfc040-on-demand-cookbook-libraries.md Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/support/shared')
-rw-r--r--spec/support/shared/integration/knife_support.rb17
1 files changed, 10 insertions, 7 deletions
diff --git a/spec/support/shared/integration/knife_support.rb b/spec/support/shared/integration/knife_support.rb
index 8de665c370..b1e01e97f2 100644
--- a/spec/support/shared/integration/knife_support.rb
+++ b/spec/support/shared/integration/knife_support.rb
@@ -1,6 +1,6 @@
#
# Author:: John Keiser (<jkeiser@chef.io>)
-# Copyright:: Copyright 2013-2017, Chef Software Inc.
+# Copyright:: Copyright 2013-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -170,21 +170,24 @@ module KnifeSupport
def should_result_in(expected)
expected[:stdout] = "" unless expected[:stdout]
+ expected[:stdout] = expected[:stdout].is_a?(String) ? expected[:stdout].gsub(/[ \t\f\v]+$/, "") : expected[:stdout]
expected[:stderr] = "" unless expected[:stderr]
+ expected[:stderr] = expected[:stderr].is_a?(String) ? expected[:stderr].gsub(/[ \t\f\v]+$/, "") : expected[:stderr]
expected[:exit_code] = 0 unless expected[:exit_code]
# TODO make this go away
stderr_actual = @stderr.sub(/^WARNING: No knife configuration file found\n/, "")
-
- if expected[:stderr].is_a?(Regexp)
- expect(stderr_actual).to match(expected[:stderr])
- else
- expect(stderr_actual).to eq(expected[:stderr])
- end
+ stderr_actual = stderr_actual.gsub(/[ \t\f\v]+$/, "")
stdout_actual = @stdout
+ stdout_actual = stdout_actual.gsub(/[ \t\f\v]+$/, "")
if ChefUtils.windows?
stderr_actual = stderr_actual.gsub("\r\n", "\n")
stdout_actual = stdout_actual.gsub("\r\n", "\n")
end
+ if expected[:stderr].is_a?(Regexp)
+ expect(stderr_actual).to match(expected[:stderr])
+ else
+ expect(stderr_actual).to eq(expected[:stderr])
+ end
expect(@exit_code).to eq(expected[:exit_code])
if expected[:stdout].is_a?(Regexp)
expect(stdout_actual).to match(expected[:stdout])