Class: IqVcardTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- IqVcardTest
- Defined in:
- lib/vendor/xmpp4r/test/vcard/tc_iqvcard.rb
Instance Method Summary collapse
- #test_create ⇒ Object
- #test_create_with_fields ⇒ Object
- #test_deep ⇒ Object
- #test_fields ⇒ Object
- #test_photo_binval ⇒ Object
- #test_photo_binval_nil ⇒ Object
Instance Method Details
#test_create ⇒ Object
11 12 13 14 |
# File 'lib/vendor/xmpp4r/test/vcard/tc_iqvcard.rb', line 11 def test_create v = Vcard::IqVcard.new assert_equal([], v.fields) end |
#test_create_with_fields ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/vendor/xmpp4r/test/vcard/tc_iqvcard.rb', line 16 def test_create_with_fields v = Vcard::IqVcard.new({'FN' => 'B C', 'NICKNAME' => 'D'}) assert_equal(['FN', 'NICKNAME'], v.fields.sort) assert_equal('B C', v['FN']) assert_equal('D', v['NICKNAME']) assert_equal(nil, v['x']) end |
#test_deep ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/vendor/xmpp4r/test/vcard/tc_iqvcard.rb', line 39 def test_deep v = Vcard::IqVcard.new({ 'FN' => 'John D. Random', 'PHOTO/TYPE' => 'image/png', 'PHOTO/BINVAL' => '===='}) assert_equal(['FN', 'PHOTO/BINVAL', 'PHOTO/TYPE'], v.fields.sort) assert_equal('John D. Random', v['FN']) assert_equal('image/png', v['PHOTO/TYPE']) assert_equal('====', v['PHOTO/BINVAL']) assert_equal(nil, v['PHOTO']) assert_equal(nil, v['NICKNAME']) end |
#test_fields ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/vendor/xmpp4r/test/vcard/tc_iqvcard.rb', line 24 def test_fields v = Vcard::IqVcard.new f = ['a', 'b', 'c', 'd', 'e'] f.each { |s| v[s.downcase] = s.upcase } assert_equal(f, v.fields.sort) f.each { |s| assert_equal(s.upcase, v[s.downcase]) assert_equal(nil, v[s.upcase]) } end |