Class: ServerErrorTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- ServerErrorTest
- Defined in:
- lib/vendor/xmpp4r/test/tc_errors.rb
Instance Method Summary collapse
- #test_create_invalid ⇒ Object
- #test_create_with_empty_error ⇒ Object
- #test_create_with_error_code ⇒ Object
- #test_to_s_with_error_code_and_text ⇒ Object
- #test_to_s_with_error_code_but_no_text ⇒ Object
Instance Method Details
#test_create_invalid ⇒ Object
25 26 27 28 29 30 |
# File 'lib/vendor/xmpp4r/test/tc_errors.rb', line 25 def test_create_invalid assert_raise(Jabber::ArgumentError) { e = ErrorResponse.new('invalid error') ee = ServerError.new(e) } end |
#test_create_with_empty_error ⇒ Object
13 14 15 16 17 |
# File 'lib/vendor/xmpp4r/test/tc_errors.rb', line 13 def test_create_with_empty_error e = ErrorResponse.new() ee = ServerError.new(e) assert_equal(nil, e.error) end |
#test_create_with_error_code ⇒ Object
19 20 21 22 23 |
# File 'lib/vendor/xmpp4r/test/tc_errors.rb', line 19 def test_create_with_error_code e = ErrorResponse.new('payment-required') ee = ServerError.new(e) assert_equal("payment-required: ", ee.to_s) end |
#test_to_s_with_error_code_and_text ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/vendor/xmpp4r/test/tc_errors.rb', line 42 def test_to_s_with_error_code_and_text e = ErrorResponse.new('payment-required', 'cuz you are a deadbeat.') ee = ServerError.new(e) assert_equal("payment-required: cuz you are a deadbeat.", ee.to_s) assert_equal('payment-required', e.error) assert_equal(402, ee.error.code) assert_equal(:auth, ee.error.type) assert_equal("cuz you are a deadbeat.", ee.error.text) end |
#test_to_s_with_error_code_but_no_text ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/vendor/xmpp4r/test/tc_errors.rb', line 32 def test_to_s_with_error_code_but_no_text e = ErrorResponse.new('payment-required') ee = ServerError.new(e) assert_equal("payment-required: ", ee.to_s) assert_equal('payment-required', e.error) assert_equal(402, ee.error.code) assert_equal(:auth, ee.error.type) assert_equal(nil, ee.error.text) end |