~singpolyma/sgx-jmp

0e62b91afefad6ed8635c330ef0df24e767ac113 — Stephen Paul Weber 2 years ago d5ca7cf
Empty URI is invalid
2 files changed, 7 insertions(+), 1 deletions(-)

M lib/customer_fwd.rb
M test/test_customer_fwd.rb
M lib/customer_fwd.rb => lib/customer_fwd.rb +1 -1
@@ 13,7 13,7 @@ class CustomerFwd
				uri = "xmpp:#{$1.gsub(/%([0-9A-F]{2})/i) { $1.to_i(16).chr }}"
			end

			URIS.fetch(uri.split(":", 2).first.to_sym) {
			URIS.fetch(uri.split(":", 2).first&.to_sym) {
				raise "Unknown forward URI: #{uri}"
			}.new(uri: uri, timeout: timeout)
		end

M test/test_customer_fwd.rb => test/test_customer_fwd.rb +6 -0
@@ 59,4 59,10 @@ class CustomerFwdTest < Minitest::Test
			CustomerFwd.for(uri: "bogus:#{bogus}", timeout: 10)
		end
	end

	def test_for_empty
		assert_raises(RuntimeError) do
			CustomerFwd.for(uri: "", timeout: 10)
		end
	end
end