Skip to content

Commit cbbba2e

Browse files
authored
pvfs-failure-context-update
This commit adds more context to the chatop tests failures by checking for keys in the json_response and raising if they do not exist. This should give users a better idea of why their expectations fail.
1 parent 55b5c7b commit cbbba2e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lib/chatops/controller/test_case_helpers.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def chatop(method, params = {})
4242
def chat(message, user, room_id = "123", message_id = "456")
4343
get :list
4444
json_response = JSON.load(response.body)
45+
raise "Invalid Chatop response - BODY: #{json_response}" unless json_response.key?("methods")
4546
matchers = json_response["methods"].map { |name, metadata|
4647
metadata = metadata.dup
4748
metadata["name"] = name
@@ -75,6 +76,7 @@ def chatop_response
7576

7677
def chatop_error
7778
json_response = JSON.load(response.body)
79+
raise "There is no chatop error - BODY: #{json_response}" unless json_response.key?("error")
7880
json_response["error"]["message"]
7981
end
8082

0 commit comments

Comments
 (0)