summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorjkeiser <jkeiser@opscode.com>2013-01-11 16:04:48 -0800
committerJohn Keiser <jkeiser@opscode.com>2013-06-07 13:12:18 -0700
commit9c6025e7d1a53da181a4309483d5192343e93394 (patch)
tree3526931757a5bf3b384cf397f62af5690a161fd2 /spec/support
parented3150d2b58cd04df699be09c86740c036b27710 (diff)
downloadchef-9c6025e7d1a53da181a4309483d5192343e93394.tar.gz
Add knife upload tests; print warnings/errors on undeleteable things
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared/integration/knife_support.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/support/shared/integration/knife_support.rb b/spec/support/shared/integration/knife_support.rb
index 98f13297e4..30d56582ed 100644
--- a/spec/support/shared/integration/knife_support.rb
+++ b/spec/support/shared/integration/knife_support.rb
@@ -60,6 +60,10 @@ module KnifeSupport
@exit_code = exit_code
end
+ attr_reader :stdout
+ attr_reader :stderr
+ attr_reader :exit_code
+
def should_fail(*args)
expected = {}
args.each do |arg|
@@ -96,8 +100,16 @@ module KnifeSupport
# TODO make this go away
stderr_actual = @stderr.sub(/^WARNING: No knife configuration file found\n/, '')
- @stdout.should == expected[:stdout]
- stderr_actual.should == expected[:stderr]
+ if expected[:stdout].is_a?(Regexp)
+ @stdout.should =~ expected[:stdout]
+ else
+ @stdout.should == expected[:stdout]
+ end
+ if expected[:stderr].is_a?(Regexp)
+ stderr_actual.should =~ expected[:stderr]
+ else
+ stderr_actual.should == expected[:stderr]
+ end
@exit_code.should == expected[:exit_code]
end
end