sr-atom-test 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. data/README.markdown +66 -0
  2. data/examples/atom-tools.rb +6 -0
  3. data/examples/atom.rb +6 -0
  4. data/tests/atom10_namespace.rb +9 -0
  5. data/tests/entry_author_email.rb +15 -0
  6. data/tests/entry_author_map_author.rb +15 -0
  7. data/tests/entry_author_map_author_2.rb +14 -0
  8. data/tests/entry_author_name.rb +18 -0
  9. data/tests/entry_author_uri.rb +19 -0
  10. data/tests/entry_category_label.rb +14 -0
  11. data/tests/entry_category_scheme.rb +14 -0
  12. data/tests/entry_category_term.rb +14 -0
  13. data/tests/entry_content_application_xml.rb +14 -0
  14. data/tests/entry_content_base64.rb +16 -0
  15. data/tests/entry_content_base64_2.rb +16 -0
  16. data/tests/entry_content_escaped_markup.rb +14 -0
  17. data/tests/entry_content_inline_markup.rb +14 -0
  18. data/tests/entry_content_inline_markup_2.rb +14 -0
  19. data/tests/entry_content_src.rb +14 -0
  20. data/tests/entry_content_text_plain.rb +14 -0
  21. data/tests/entry_content_text_plain_brackets.rb +14 -0
  22. data/tests/entry_content_type.rb +14 -0
  23. data/tests/entry_content_type_text.rb +14 -0
  24. data/tests/entry_content_value.rb +14 -0
  25. data/tests/entry_contributor_email.rb +18 -0
  26. data/tests/entry_contributor_multiple.rb +32 -0
  27. data/tests/entry_contributor_name.rb +18 -0
  28. data/tests/entry_contributor_uri.rb +18 -0
  29. data/tests/entry_id.rb +14 -0
  30. data/tests/entry_id_no_normalization_1.rb +14 -0
  31. data/tests/entry_id_no_normalization_2.rb +14 -0
  32. data/tests/entry_id_no_normalization_3.rb +14 -0
  33. data/tests/entry_id_no_normalization_4.rb +14 -0
  34. data/tests/entry_id_no_normalization_5.rb +14 -0
  35. data/tests/entry_id_no_normalization_6.rb +14 -0
  36. data/tests/entry_id_no_normalization_7.rb +14 -0
  37. data/tests/entry_link_href.rb +14 -0
  38. data/tests/entry_link_hreflang.rb +14 -0
  39. data/tests/entry_link_length.rb +14 -0
  40. data/tests/entry_link_multiple.rb +24 -0
  41. data/tests/entry_link_no_rel.rb +14 -0
  42. data/tests/entry_link_rel.rb +14 -0
  43. data/tests/entry_link_rel_other.rb +14 -0
  44. data/tests/entry_link_rel_related.rb +14 -0
  45. data/tests/entry_link_rel_self.rb +14 -0
  46. data/tests/entry_link_rel_via.rb +14 -0
  47. data/tests/entry_link_title.rb +14 -0
  48. data/tests/entry_link_type.rb +14 -0
  49. data/tests/entry_rights.rb +14 -0
  50. data/tests/entry_rights_content_value.rb +14 -0
  51. data/tests/entry_rights_escaped_markup.rb +14 -0
  52. data/tests/entry_rights_inline_markup.rb +14 -0
  53. data/tests/entry_rights_inline_markup_2.rb +14 -0
  54. data/tests/entry_rights_text_plain.rb +14 -0
  55. data/tests/entry_rights_text_plain_brackets.rb +14 -0
  56. data/tests/entry_rights_type_default.rb +14 -0
  57. data/tests/entry_rights_type_text.rb +14 -0
  58. data/tests/entry_source_author_email.rb +20 -0
  59. data/tests/entry_source_author_map_author.rb +20 -0
  60. data/tests/entry_source_author_map_author_2.rb +19 -0
  61. data/tests/entry_source_author_name.rb +20 -0
  62. data/tests/entry_source_author_uri.rb +20 -0
  63. data/tests/entry_source_category_label.rb +16 -0
  64. data/tests/entry_source_category_scheme.rb +16 -0
  65. data/tests/entry_source_category_term.rb +16 -0
  66. data/tests/entry_source_contributor_email.rb +20 -0
  67. data/tests/entry_source_contributor_multiple.rb +34 -0
  68. data/tests/entry_source_contributor_name.rb +20 -0
  69. data/tests/entry_source_contributor_uri.rb +20 -0
  70. data/tests/entry_source_generator.rb +16 -0
  71. data/tests/entry_source_generator_uri.rb +16 -0
  72. data/tests/entry_source_generator_version.rb +16 -0
  73. data/tests/entry_source_icon.rb +16 -0
  74. data/tests/entry_source_id.rb +16 -0
  75. data/tests/entry_source_link_href.rb +16 -0
  76. data/tests/entry_source_link_hreflang.rb +16 -0
  77. data/tests/entry_source_link_length.rb +16 -0
  78. data/tests/entry_source_link_multiple.rb +24 -0
  79. data/tests/entry_source_link_no_rel.rb +16 -0
  80. data/tests/entry_source_link_rel.rb +16 -0
  81. data/tests/entry_source_link_rel_other.rb +16 -0
  82. data/tests/entry_source_link_rel_related.rb +16 -0
  83. data/tests/entry_source_link_rel_self.rb +16 -0
  84. data/tests/entry_source_link_rel_via.rb +16 -0
  85. data/tests/entry_source_link_title.rb +16 -0
  86. data/tests/entry_source_link_type.rb +16 -0
  87. data/tests/entry_source_logo.rb +16 -0
  88. data/tests/entry_source_rights.rb +16 -0
  89. data/tests/entry_source_rights_content_type.rb +16 -0
  90. data/tests/entry_source_rights_content_type_text.rb +16 -0
  91. data/tests/entry_source_rights_content_value.rb +16 -0
  92. data/tests/entry_source_rights_escaped_markup.rb +16 -0
  93. data/tests/entry_source_rights_inline_markup.rb +16 -0
  94. data/tests/entry_source_rights_inline_markup_2.rb +16 -0
  95. data/tests/entry_source_rights_text_plain.rb +16 -0
  96. data/tests/entry_source_subtitle.rb +16 -0
  97. data/tests/entry_source_subtitle_content_type.rb +16 -0
  98. data/tests/entry_source_subtitle_content_type_text.rb +16 -0
  99. data/tests/entry_source_subtitle_content_value.rb +16 -0
  100. data/tests/entry_source_subtitle_escaped_markup.rb +16 -0
  101. data/tests/entry_source_subtitle_inline_markup.rb +16 -0
  102. data/tests/entry_source_subtitle_inline_markup_2.rb +16 -0
  103. data/tests/entry_source_subtitle_text_plain.rb +16 -0
  104. data/tests/entry_source_title.rb +16 -0
  105. data/tests/entry_source_title_content_type.rb +16 -0
  106. data/tests/entry_source_title_content_type_text.rb +16 -0
  107. data/tests/entry_source_title_content_value.rb +16 -0
  108. data/tests/entry_source_title_escaped_markup.rb +16 -0
  109. data/tests/entry_source_title_inline_markup.rb +16 -0
  110. data/tests/entry_source_title_inline_markup_2.rb +16 -0
  111. data/tests/entry_source_title_text_plain.rb +16 -0
  112. data/tests/entry_summary.rb +14 -0
  113. data/tests/entry_summary_content_value.rb +14 -0
  114. data/tests/entry_summary_escaped_markup.rb +14 -0
  115. data/tests/entry_summary_inline_markup.rb +14 -0
  116. data/tests/entry_summary_inline_markup_2.rb +14 -0
  117. data/tests/entry_summary_text_plain.rb +14 -0
  118. data/tests/entry_summary_type_default.rb +14 -0
  119. data/tests/entry_summary_type_text.rb +14 -0
  120. data/tests/entry_title.rb +14 -0
  121. data/tests/entry_title_content_value.rb +14 -0
  122. data/tests/entry_title_escaped_markup.rb +14 -0
  123. data/tests/entry_title_inline_markup.rb +14 -0
  124. data/tests/entry_title_inline_markup_2.rb +14 -0
  125. data/tests/entry_title_text_plain.rb +14 -0
  126. data/tests/entry_title_text_plain_brackets.rb +14 -0
  127. data/tests/entry_title_type_default.rb +14 -0
  128. data/tests/entry_title_type_text.rb +14 -0
  129. data/tests/feed_author_email.rb +16 -0
  130. data/tests/feed_author_map_author.rb +16 -0
  131. data/tests/feed_author_map_author_2.rb +15 -0
  132. data/tests/feed_author_name.rb +16 -0
  133. data/tests/feed_author_uri.rb +16 -0
  134. data/tests/feed_contributor_email.rb +16 -0
  135. data/tests/feed_contributor_multiple.rb +28 -0
  136. data/tests/feed_contributor_name.rb +16 -0
  137. data/tests/feed_contributor_uri.rb +16 -0
  138. data/tests/feed_generator.rb +12 -0
  139. data/tests/feed_generator_name.rb +12 -0
  140. data/tests/feed_generator_url.rb +12 -0
  141. data/tests/feed_generator_version.rb +12 -0
  142. data/tests/feed_icon.rb +12 -0
  143. data/tests/feed_id.rb +12 -0
  144. data/tests/feed_link_href.rb +12 -0
  145. data/tests/feed_link_hreflang.rb +12 -0
  146. data/tests/feed_link_length.rb +12 -0
  147. data/tests/feed_link_multiple.rb +21 -0
  148. data/tests/feed_link_no_rel.rb +12 -0
  149. data/tests/feed_link_rel.rb +12 -0
  150. data/tests/feed_link_rel_other.rb +12 -0
  151. data/tests/feed_link_rel_related.rb +12 -0
  152. data/tests/feed_link_rel_self.rb +12 -0
  153. data/tests/feed_link_rel_via.rb +12 -0
  154. data/tests/feed_link_title.rb +12 -0
  155. data/tests/feed_link_type.rb +12 -0
  156. data/tests/feed_logo.rb +12 -0
  157. data/tests/feed_rights.rb +12 -0
  158. data/tests/feed_rights_content_type.rb +12 -0
  159. data/tests/feed_rights_content_type_text.rb +12 -0
  160. data/tests/feed_rights_content_value.rb +12 -0
  161. data/tests/feed_rights_escaped_markup.rb +12 -0
  162. data/tests/feed_rights_inline_markup.rb +12 -0
  163. data/tests/feed_rights_inline_markup_2.rb +12 -0
  164. data/tests/feed_rights_text_plain.rb +12 -0
  165. data/tests/feed_subtitle.rb +12 -0
  166. data/tests/feed_subtitle_content_type.rb +12 -0
  167. data/tests/feed_subtitle_content_type_text.rb +12 -0
  168. data/tests/feed_subtitle_content_value.rb +12 -0
  169. data/tests/feed_subtitle_escaped_markup.rb +12 -0
  170. data/tests/feed_subtitle_inline_markup.rb +12 -0
  171. data/tests/feed_subtitle_inline_markup_2.rb +12 -0
  172. data/tests/feed_subtitle_text_plain.rb +12 -0
  173. data/tests/feed_title.rb +12 -0
  174. data/tests/feed_title_content_type.rb +12 -0
  175. data/tests/feed_title_content_type_text.rb +12 -0
  176. data/tests/feed_title_content_value.rb +12 -0
  177. data/tests/feed_title_escaped_markup.rb +12 -0
  178. data/tests/feed_title_inline_markup.rb +12 -0
  179. data/tests/feed_title_inline_markup_2.rb +12 -0
  180. data/tests/feed_title_text_plain.rb +12 -0
  181. data/tests/relative_uri.rb +12 -0
  182. data/tests/relative_uri_inherit.rb +12 -0
  183. data/tests/relative_uri_inherit_2.rb +12 -0
  184. metadata +236 -0
@@ -0,0 +1,66 @@
1
+ Atom::Test
2
+ ==========
3
+
4
+ [Atom Syndication Format][atom] test suite for Ruby.
5
+
6
+ Imported from the [Ruby Atom library][atomrb] tests which were
7
+ themselfs imported from the [Universal Feed Parser][ufp].
8
+
9
+ [atom]: http://www.ietf.org/rfc/rfc4287
10
+ [atomrb]: http://atom.rubyforge.org
11
+ [ufp]: http://feedparser.org/tests
12
+
13
+ License
14
+ -------
15
+
16
+ Copyright (c) 2008 Simon Rozet <simon@rozet.name>
17
+ Copyright (c) 2006 Martin Traverso
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining
20
+ a copy of this software and associated documentation files (the
21
+ "Software"), to deal in the Software without restriction, including
22
+ without limitation the rights to use, copy, modify, merge, publish,
23
+ distribute, sublicense, and/or sell copies of the Software, and to
24
+ permit persons to whom the Software is furnished to do so, subject to
25
+ the following conditions:
26
+
27
+ The above copyright notice and this permission notice shall be
28
+ included in all copies or substantial portions of the Software.
29
+
30
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37
+
38
+ - - -
39
+
40
+ Tests are derived from Universal Feed Parser <http://feedparser.org>
41
+
42
+ Copyright (c) 2002-2005, Mark Pilgrim
43
+ All rights reserved.
44
+
45
+ Redistribution and use in source and binary forms, with or without modification,
46
+ are permitted provided that the following conditions are met:
47
+
48
+ * Redistributions of source code must retain the above copyright notice,
49
+ this list of conditions and the following disclaimer.
50
+ * Redistributions in binary form must reproduce the above copyright notice,
51
+ this list of conditions and the following disclaimer in the documentation
52
+ and/or other materials provided with the distribution.
53
+
54
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
55
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
58
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
59
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
60
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
61
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
62
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
63
+ ARISING IN ANY WAY OUT OF THE USE OF
64
+
65
+
66
+
@@ -0,0 +1,6 @@
1
+ require File.dirname(__FILE__) + '/../atom_test'
2
+
3
+ require 'rubygems'
4
+ require 'atom/feed'
5
+
6
+ Atom::Test.create_test_for! :all
@@ -0,0 +1,6 @@
1
+ # because it conflicts with atom-tools
2
+ require File.expand_path('~/.gems/gems/atom-0.3/lib/atom')
3
+
4
+ require File.dirname(__FILE__) + '/../atom_test'
5
+
6
+ Atom::Test.create_test_for! :all
@@ -0,0 +1,9 @@
1
+ xml = <<XML
2
+ <feed xmlns="http://www.w3.org/2005/Atom">
3
+ <title>Example Atom</title>
4
+ </feed>
5
+ XML
6
+
7
+ test = lambda { |feed|
8
+ assert_equal 'Example Atom', feed.title
9
+ }
@@ -0,0 +1,15 @@
1
+ xml = <<XML
2
+ <feed xmlns="http://www.w3.org/2005/Atom">
3
+ <entry>
4
+ <author>
5
+ <name>Example author</name>
6
+ <email>me@example.com</email>
7
+ <uri>http://example.com/</uri>
8
+ </author>
9
+ </entry>
10
+ </feed>
11
+ XML
12
+
13
+ test = lambda { |feed|
14
+ assert_equal 'me@example.com', feed.entries.first.authors.first.email
15
+ }
@@ -0,0 +1,15 @@
1
+ xml = <<XML
2
+ <feed xmlns="http://www.w3.org/2005/Atom">
3
+ <entry>
4
+ <author>
5
+ <name>Example author</name>
6
+ <email>me@example.com</email>
7
+ <uri>http://example.com/</uri>
8
+ </author>
9
+ </entry>
10
+ </feed>
11
+ XML
12
+
13
+ test = lambda { |feed|
14
+ assert_equal "Example author (me@example.com)", feed.entries.first.authors.first.to_s
15
+ }
@@ -0,0 +1,14 @@
1
+ xml = <<XML
2
+ <feed xmlns="http://www.w3.org/2005/Atom">
3
+ <entry>
4
+ <author>
5
+ <name>Example author</name>
6
+ <uri>http://example.com/</uri>
7
+ </author>
8
+ </entry>
9
+ </feed>
10
+ XML
11
+
12
+ test = lambda { |feed|
13
+ assert_equal 'Example author', feed.entries.first.authors.first.to_s
14
+ }
@@ -0,0 +1,18 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry author name
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <author>
8
+ <name>Example author</name>
9
+ <email>me@example.com</email>
10
+ <uri>http://example.com/</uri>
11
+ </author>
12
+ </entry>
13
+ </feed>
14
+ XML
15
+
16
+ test = lambda { |feed|
17
+ assert_equal 'Example author', feed.entries[0].authors.first.name
18
+ }
@@ -0,0 +1,19 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry author uri
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <author>
8
+ <name>Example author</name>
9
+ <email>me@example.com</email>
10
+ <uri>http://example.com/</uri>
11
+ </author>
12
+ </entry>
13
+
14
+ </feed>
15
+ XML
16
+
17
+ test = lambda { |feed|
18
+ assert_equal 'http://example.com/', feed.entries[0].authors.first.uri
19
+ }
@@ -0,0 +1,14 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry category label
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <category term="atom10" scheme="http://feedparser.org/tests/" label="Atom 1.0 tests"/>
8
+ </entry>
9
+ </feed>
10
+ XML
11
+
12
+ test = lambda { |feed|
13
+ assert_equal 'Atom 1.0 tests', feed.entries[0].categories[0].label
14
+ }
@@ -0,0 +1,14 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry category scheme
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <category term="atom10" scheme="http://feedparser.org/tests/" label="Atom 1.0 tests"/>
8
+ </entry>
9
+ </feed>
10
+ XML
11
+
12
+ test = lambda { |feed|
13
+ assert_equal 'http://feedparser.org/tests/', feed.entries[0].categories[0].scheme
14
+ }
@@ -0,0 +1,14 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry category term
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <category term="atom10" scheme="http://feedparser.org/tests/" label="Atom 1.0 tests"/>
8
+ </entry>
9
+ </feed>
10
+ XML
11
+
12
+ test = lambda { |feed|
13
+ assert_equal 'atom10', feed.entries[0].categories[0].term
14
+ }
@@ -0,0 +1,14 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry content inline XML
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">Example <b>Atom</b></div></content>
8
+ </entry>
9
+ </feed>
10
+ XML
11
+
12
+ test = lambda { |feed|
13
+ assert_equal 'Example <b>Atom</b>', feed.entries[0].content.value
14
+ }
@@ -0,0 +1,16 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry content base64-encoded
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <content type="application/octet-stream">
8
+ RXhhbXBsZSA8Yj5BdG9tPC9iPg==
9
+ </content>
10
+ </entry>
11
+ </feed>
12
+ XML
13
+
14
+ test = lambda { |feed|
15
+ assert_equal 'Example <b>Atom</b>', feed.entries[0].content.value
16
+ }
@@ -0,0 +1,16 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry content base64-encoded
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <content type="application/octet-stream">
8
+ PHA+SGlzdG9yeSBvZiB0aGUgJmx0O2JsaW5rJmd0OyB0YWc8L3A+
9
+ </content>
10
+ </entry>
11
+ </feed>
12
+ XML
13
+
14
+ test = lambda { |feed|
15
+ assert_equal '<p>History of the &lt;blink&gt; tag</p>', feed.entries[0].content.value
16
+ }
@@ -0,0 +1,14 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry content escaped HTML
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <content type="html">Example &lt;b&gt;Atom&lt;/b&gt;</content>
8
+ </entry>
9
+ </feed>
10
+ XML
11
+
12
+ test = lambda { |feed|
13
+ assert_equal 'Example <b>Atom</b>', feed.entries[0].content.value
14
+ }
@@ -0,0 +1,14 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry content inline XHTML
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">Example <b>Atom</b></div></content>
8
+ </entry>
9
+ </feed>
10
+ XML
11
+
12
+ test = lambda { |feed|
13
+ assert_equal 'Example <b>Atom</b>', feed.entries[0].content.value
14
+ }
@@ -0,0 +1,14 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry content inline XHTML with escaped markup
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">History of the &lt;blink&gt; tag</div></content>
8
+ </entry>
9
+ </feed>
10
+ XML
11
+
12
+ test = lambda { |feed|
13
+ assert_equal 'History of the &lt;blink&gt; tag', feed.entries[0].content.value
14
+ }
@@ -0,0 +1,14 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry content src
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <content src="http://example.com/movie.mp4"/>
8
+ </entry>
9
+ </feed>
10
+ XML
11
+
12
+ test = lambda { |feed|
13
+ assert_equal 'http://example.com/movie.mp4', feed.entries[0].content.src
14
+ }
@@ -0,0 +1,14 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry content with explicit type='text'
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <content type="text">Example Atom</content>
8
+ </entry>
9
+ </feed>
10
+ XML
11
+
12
+ test = lambda { |feed|
13
+ assert_equal 'Example Atom', feed.entries[0].content.value
14
+ }
@@ -0,0 +1,14 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry content with explicit type='text' contains brackets that are not markup
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <content type="text">History of the &lt;blink&gt; tag</content>
8
+ </entry>
9
+ </feed>
10
+ XML
11
+
12
+ test = lambda { |feed|
13
+ assert_equal 'History of the <blink> tag', feed.entries[0].content.value
14
+ }
@@ -0,0 +1,14 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry content content type defaults to 'text/plain'
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <content>Example Atom</content>
8
+ </entry>
9
+ </feed>
10
+ XML
11
+
12
+ test = lambda { |feed|
13
+ assert_equal 'text/plain', feed.entries[0].content.mime_type
14
+ }
@@ -0,0 +1,14 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry content type='text'
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <content type="text">Example Atom</content>
8
+ </entry>
9
+ </feed>
10
+ XML
11
+
12
+ test = lambda { |feed|
13
+ assert_equal 'text/plain', feed.entries[0].content.mime_type
14
+ }
@@ -0,0 +1,14 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry content content value
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <content>Example Atom</content>
8
+ </entry>
9
+ </feed>
10
+ XML
11
+
12
+ test = lambda { |feed|
13
+ assert_equal 'Example Atom', feed.entries[0].content.value
14
+ }
@@ -0,0 +1,18 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: entry contributor email
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <contributor>
8
+ <name>Example contributor</name>
9
+ <email>me@example.com</email>
10
+ <uri>http://example.com/</uri>
11
+ </contributor>
12
+ </entry>
13
+ </feed>
14
+ XML
15
+
16
+ test = lambda { |feed|
17
+ assert_equal 'me@example.com', feed.entries[0].contributors[0].email
18
+ }
@@ -0,0 +1,32 @@
1
+ xml = <<XML
2
+ <!--
3
+ Description: multiple entry contributors
4
+ -->
5
+ <feed xmlns="http://www.w3.org/2005/Atom">
6
+ <entry>
7
+ <contributor>
8
+ <name>Contributor 1</name>
9
+ <email>me@example.com</email>
10
+ <uri>http://example.com/</uri>
11
+ </contributor>
12
+ <contributor>
13
+ <name>Contributor 2</name>
14
+ <email>you@example.com</email>
15
+ <uri>http://two.example.com/</uri>
16
+ </contributor>
17
+ </entry>
18
+ </feed>
19
+ XML
20
+
21
+ test = lambda { |feed|
22
+ contributors = feed.entries[0].contributors
23
+
24
+ assert_equal 2, contributors.size
25
+ assert_equal 'Contributor 1', contributors[0].name
26
+ assert_equal 'me@example.com', contributors[0].email
27
+ assert_equal 'http://example.com/', contributors[0].uri
28
+
29
+ assert_equal 'Contributor 2', contributors[1].name
30
+ assert_equal 'you@example.com', contributors[1].email
31
+ assert_equal 'http://two.example.com/', contributors[1].uri
32
+ }