M lib/customer_fwd.rb => lib/customer_fwd.rb +1 -1
@@ 22,7 22,7 @@ class CustomerFwd
end
def initialize(s)
- @timeout = s.nil? || s.to_i.negative? ? 300 : s.to_i
+ @timeout = s.nil? || s.to_i.negative? || s.to_i > 300 ? 300 : s.to_i
end
def zero?
M test/test_customer_fwd.rb => test/test_customer_fwd.rb +5 -0
@@ 12,6 12,11 @@ class Rantly
end
class CustomerFwdTest < Minitest::Test
+ def test_too_big_timeout
+ fwd = CustomerFwd.for(uri: "xmpp:test@example.com", timeout: 500)
+ assert_equal 300, fwd.timeout.to_i
+ end
+
property(:for_xmpp) { jid }
def for_xmpp(jid)
sip = "sip:#{ERB::Util.url_encode(jid.to_s)}@sip.cheogram.com"