refactor: xmpp_error_{text,name} -> test_helper

Phillip Davis created

Change summary

test/test_helper.rb | 12 ++++++++++++
1 file changed, 12 insertions(+)

Detailed changes

test/test_helper.rb 🔗

@@ -66,6 +66,18 @@ def invoke_webhook(payload, extra_env: {})
 	end
 end
 
+def xmpp_error_name(error)
+	error.find_first(
+		"child::*[name()!='text']",
+		Blather::StanzaError::STANZA_ERR_NS
+	).element_name
+end
+
+def xmpp_error_text(error)
+	error.find_first("ns:text", ns: Blather::StanzaError::STANZA_ERR_NS)&.text
+end
+
+
 begin
 	require "pry-byebug"