From 6063249164c0378337d46bda6616f7caf34f6566 Mon Sep 17 00:00:00 2001 From: Chirag Jog Date: Mon, 21 Jan 2013 09:47:30 +0530 Subject: [PATCH] Check for stout, stderr along with status code --- lib/knife_cloud_tests/helper.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/knife_cloud_tests/helper.rb b/lib/knife_cloud_tests/helper.rb index 048096e..9da7e02 100644 --- a/lib/knife_cloud_tests/helper.rb +++ b/lib/knife_cloud_tests/helper.rb @@ -41,14 +41,13 @@ def find_id(instance_name, line) end end -def match_status(test_run_expect) - if "#{test_run_expect}" == "should fail" +def match_status(expect_params) + expected_status = expect_params[:status] + expected_stdout = expect_params[:stdout] + expected_stderr = expect_params[:stderr] + if "#{expected_status}" == "should fail" should_not have_outcome :status => 0 - elsif "#{test_run_expect}" == "should succeed" - should have_outcome :status => 0 - elsif "#{test_run_expect}" == "should return empty list" - should have_outcome :status => 0 - else - should have_outcome :status => 0 + elsif "#{expected_status}" == "should succeed" or "#{expected_status}" == "should return empty list" + should have_outcome :status => 0, :stdout => /#{expected_stdout}/, :stderr => /#{expected_stderr}/ end end