test/command_response_test.rb in bixby-common-0.4.11 vs test/command_response_test.rb in bixby-common-0.4.12

- old
+ new

@@ -13,10 +13,15 @@ refute res.success? cr = CommandResponse.from_json_response(res) assert_kind_of CommandResponse, cr assert_equal 255, cr.status assert_equal "unknown", cr.stderr + + assert_throws(CommandException) do + cr.raise! + end + begin cr.raise! rescue CommandException => ex assert_equal "unknown", ex.message end @@ -27,9 +32,19 @@ cr = CommandResponse.from_json_response(res) assert_kind_of CommandResponse, cr assert_equal 0, cr.status assert_equal "foobar", cr.stdout assert_nil cr.stderr + + # empty failure message + res = JsonResponse.new("fail") + assert res.fail? + refute res.success? + cr = CommandResponse.from_json_response(res) + refute cr.success? + assert cr.fail? + assert cr.error? + assert_equal 255, cr.status end def test_to_json_response cr = CommandResponse.new(:status => 50, :stdout => "foobar", :stderr => "baz") js = cr.to_json_response