feedtools 0.2.17 → 0.2.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,27 @@
1
+ #--
2
+ # Copyright (c) 2005 Robert Aman
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
24
+ module FeedTools
25
+ module FeedHelper
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ #--
2
+ # Copyright (c) 2005 Robert Aman
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
24
+ module FeedTools
25
+ module FeedItemHelper
26
+ end
27
+ end
@@ -0,0 +1,78 @@
1
+ #--
2
+ # Copyright (c) 2005 Robert Aman
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #
23
+ # Contributors: Jens Kraemer
24
+ #++
25
+
26
+ require 'feed_tools'
27
+ require 'feed_tools/helpers/generic_helper'
28
+
29
+ # This module provides helper methods for simplifying normal interactions with
30
+ # the FeedTools library.
31
+ module FeedToolsHelper
32
+ include FeedTools::GenericHelper
33
+ private :validate_options
34
+
35
+ @@default_local_path = File.expand_path('.')
36
+
37
+ # Returns the default path to load local files from
38
+ def self.default_local_path
39
+ @@default_local_path
40
+ end
41
+
42
+ # Sets the default path to load local files from
43
+ def self.default_local_path=(new_default_local_path)
44
+ @@default_local_path = new_default_local_path
45
+ end
46
+
47
+ protected
48
+ # Loads a feed within a block for more consistent syntax and control
49
+ # over the FeedTools environment.
50
+ def with_feed(options={})
51
+ validate_options([ :from_file, :from_url, :from_data, :feed_cache ],
52
+ options.keys)
53
+ options = { :feed_cache => FeedTools.feed_cache }.merge(options)
54
+ if options[:from_file]
55
+ file_path = File.expand_path(@@default_local_path + '/' +
56
+ options[:from_file])
57
+ if !File.exists?(file_path)
58
+ file_path = File.expand_path(options[:from_file])
59
+ end
60
+ if !File.exists?(file_path)
61
+ raise "No such file - #{file_path}"
62
+ end
63
+ feed = FeedTools::Feed.open("file://#{file_path}")
64
+ elsif options[:from_url]
65
+ feed = FeedTools::Feed.open(options[:from_url])
66
+ elsif options[:from_data]
67
+ feed = FeedTools::Feed.new
68
+ feed.feed_data = options[:from_data]
69
+ else
70
+ raise "No data source specified"
71
+ end
72
+ @@save_cache = FeedTools.feed_cache
73
+ FeedTools.feed_cache = options[:feed_cache]
74
+ yield feed
75
+ FeedTools.feed_cache = @@save_cache
76
+ feed = nil
77
+ end
78
+ end
@@ -0,0 +1,36 @@
1
+ #--
2
+ # Copyright (c) 2005 Robert Aman
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
24
+ module FeedTools
25
+ # Generic methods needed in numerous places throughout FeedTools
26
+ module GenericHelper
27
+ # Raises an exception if an invalid option has been specified to prevent
28
+ # misspellings from slipping through
29
+ def validate_options(valid_option_keys, supplied_option_keys)
30
+ unknown_option_keys = supplied_option_keys - valid_option_keys
31
+ unless unknown_option_keys.empty?
32
+ raise "Unknown options: #{unknown_option_keys}"
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,27 @@
1
+ #--
2
+ # Copyright (c) 2005 Robert Aman
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
24
+ module FeedTools
25
+ module FeedToolsModuleHelper
26
+ end
27
+ end
data/rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rake/gempackagetask'
7
7
  require 'rake/contrib/rubyforgepublisher'
8
8
 
9
9
  PKG_NAME = 'feedtools'
10
- PKG_VERSION = '0.2.17'
10
+ PKG_VERSION = '0.2.18'
11
11
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
12
12
 
13
13
  RELEASE_NAME = "REL #{PKG_VERSION}"
@@ -18,7 +18,7 @@ RUBY_FORGE_USER = "vacindak"
18
18
  PKG_FILES = FileList[
19
19
  "lib/**/*", "test/**/*", "examples/**/*", "doc/**/*", "db/**/*",
20
20
  "[A-Z]*", "install.rb", "rakefile"
21
- ].exclude(/\bCVS\b|~$/).exclude(/database\.yml/)
21
+ ].exclude(/\bCVS\b|~$/).exclude(/database\.yml/).exclude(/\._.*/)
22
22
 
23
23
  desc "Default Task"
24
24
  task :default => [ :test_all ]
@@ -1,399 +1,404 @@
1
1
  require 'test/unit'
2
2
  require 'feed_tools'
3
+ require 'feed_tools/helpers/feed_tools_helper'
3
4
 
4
5
  class AmpTest < Test::Unit::TestCase
6
+ include FeedToolsHelper
7
+
5
8
  def setup
6
9
  FeedTools.tidy_enabled = false
7
10
  FeedTools.feed_cache = FeedTools::DatabaseFeedCache
11
+ FeedToolsHelper.default_local_path =
12
+ File.expand_path(
13
+ File.expand_path(File.dirname(__FILE__)) + '/../feeds')
8
14
  end
9
15
 
10
16
  def test_amp_01
11
- feed = FeedTools::Feed.open(
12
- 'http://feedparser.org/tests/wellformed/amp/amp01.xml')
13
- assert_equal("&amp;", feed.entries.first.title)
17
+ with_feed(:from_file => 'wellformed/amp/amp01.xml') { |feed|
18
+ assert_equal("&amp;", feed.entries.first.title)
19
+ }
14
20
  end
15
21
 
16
22
  def test_amp_02
17
- feed = FeedTools::Feed.open(
18
- 'http://feedparser.org/tests/wellformed/amp/amp02.xml')
19
- assert_equal("&amp;", feed.entries.first.title)
23
+ with_feed(:from_file => 'wellformed/amp/amp02.xml') { |feed|
24
+ assert_equal("&amp;", feed.entries.first.title)
25
+ }
20
26
  end
21
27
 
22
28
  def test_amp_03
23
- feed = FeedTools::Feed.open(
24
- 'http://feedparser.org/tests/wellformed/amp/amp03.xml')
25
- assert_equal("&", feed.entries.first.title)
29
+ with_feed(:from_file => 'wellformed/amp/amp03.xml') { |feed|
30
+ assert_equal("&", feed.entries.first.title)
31
+ }
26
32
  end
27
33
 
28
34
  def test_amp_04
29
- feed = FeedTools::Feed.open(
30
- 'http://feedparser.org/tests/wellformed/amp/amp04.xml')
31
- assert_equal("&amp;", feed.entries.first.title)
35
+ with_feed(:from_file => 'wellformed/amp/amp04.xml') { |feed|
36
+ assert_equal("&amp;", feed.entries.first.title)
37
+ }
32
38
  end
33
39
 
34
40
  def test_amp_05
35
- feed = FeedTools::Feed.open(
36
- 'http://feedparser.org/tests/wellformed/amp/amp05.xml')
37
- assert_equal("&amp;", feed.entries.first.title)
41
+ with_feed(:from_file => 'wellformed/amp/amp05.xml') { |feed|
42
+ assert_equal("&amp;", feed.entries.first.title)
43
+ }
38
44
  end
39
45
 
40
46
  def test_amp_06
41
- feed = FeedTools::Feed.open(
42
- 'http://feedparser.org/tests/wellformed/amp/amp06.xml')
43
- assert_equal("&amp;", feed.entries.first.title)
47
+ with_feed(:from_file => 'wellformed/amp/amp06.xml') { |feed|
48
+ assert_equal("&amp;", feed.entries.first.title)
49
+ }
44
50
  end
45
51
 
46
52
  def test_amp_07
47
- feed = FeedTools::Feed.open(
48
- 'http://feedparser.org/tests/wellformed/amp/amp07.xml')
49
- assert_equal("&", feed.entries.first.title)
53
+ with_feed(:from_file => 'wellformed/amp/amp07.xml') { |feed|
54
+ assert_equal("&", feed.entries.first.title)
55
+ }
50
56
  end
51
57
 
52
58
  def test_amp_08
53
- feed = FeedTools::Feed.open(
54
- 'http://feedparser.org/tests/wellformed/amp/amp08.xml')
55
- assert_equal("&amp;", feed.entries.first.title)
59
+ with_feed(:from_file => 'wellformed/amp/amp08.xml') { |feed|
60
+ assert_equal("&amp;", feed.entries.first.title)
61
+ }
56
62
  end
57
63
 
58
64
  def test_amp_09
59
- feed = FeedTools::Feed.open(
60
- 'http://feedparser.org/tests/wellformed/amp/amp09.xml')
61
- assert_equal("&amp;", feed.entries.first.title)
65
+ with_feed(:from_file => 'wellformed/amp/amp09.xml') { |feed|
66
+ assert_equal("&amp;", feed.entries.first.title)
67
+ }
62
68
  end
63
69
 
64
70
  def test_amp_10
65
- feed = FeedTools::Feed.open(
66
- 'http://feedparser.org/tests/wellformed/amp/amp10.xml')
67
- assert_equal("&amp;", feed.entries.first.title)
71
+ with_feed(:from_file => 'wellformed/amp/amp10.xml') { |feed|
72
+ assert_equal("&amp;", feed.entries.first.title)
73
+ }
68
74
  end
69
75
 
70
76
  def test_amp_11
71
- feed = FeedTools::Feed.open(
72
- 'http://feedparser.org/tests/wellformed/amp/amp11.xml')
73
- assert_equal("&", feed.entries.first.title)
77
+ with_feed(:from_file => 'wellformed/amp/amp11.xml') { |feed|
78
+ assert_equal("&", feed.entries.first.title)
79
+ }
74
80
  end
75
81
 
76
82
  def test_amp_12
77
- feed = FeedTools::Feed.open(
78
- 'http://feedparser.org/tests/wellformed/amp/amp12.xml')
79
- assert_equal("&amp;", feed.entries.first.title)
83
+ with_feed(:from_file => 'wellformed/amp/amp12.xml') { |feed|
84
+ assert_equal("&amp;", feed.entries.first.title)
85
+ }
80
86
  end
81
87
 
82
88
  def test_amp_13
83
- feed = FeedTools::Feed.open(
84
- 'http://feedparser.org/tests/wellformed/amp/amp13.xml')
85
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
89
+ with_feed(:from_file => 'wellformed/amp/amp13.xml') { |feed|
90
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
91
+ }
86
92
  end
87
93
 
88
94
  def test_amp_14
89
- feed = FeedTools::Feed.open(
90
- 'http://feedparser.org/tests/wellformed/amp/amp14.xml')
91
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
95
+ with_feed(:from_file => 'wellformed/amp/amp14.xml') { |feed|
96
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
97
+ }
92
98
  end
93
99
 
94
100
  def test_amp_15
95
- feed = FeedTools::Feed.open(
96
- 'http://feedparser.org/tests/wellformed/amp/amp15.xml')
97
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
101
+ with_feed(:from_file => 'wellformed/amp/amp15.xml') { |feed|
102
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
103
+ }
98
104
  end
99
105
 
100
106
  def test_amp_16
101
- feed = FeedTools::Feed.open(
102
- 'http://feedparser.org/tests/wellformed/amp/amp16.xml')
103
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
107
+ with_feed(:from_file => 'wellformed/amp/amp16.xml') { |feed|
108
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
109
+ }
104
110
  end
105
111
 
106
112
  def test_amp_17
107
- feed = FeedTools::Feed.open(
108
- 'http://feedparser.org/tests/wellformed/amp/amp17.xml')
109
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
113
+ with_feed(:from_file => 'wellformed/amp/amp17.xml') { |feed|
114
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
115
+ }
110
116
  end
111
117
 
112
118
  def test_amp_18
113
- feed = FeedTools::Feed.open(
114
- 'http://feedparser.org/tests/wellformed/amp/amp18.xml')
115
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
119
+ with_feed(:from_file => 'wellformed/amp/amp18.xml') { |feed|
120
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
121
+ }
116
122
  end
117
123
 
118
124
  def test_amp_19
119
- feed = FeedTools::Feed.open(
120
- 'http://feedparser.org/tests/wellformed/amp/amp19.xml')
121
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
125
+ with_feed(:from_file => 'wellformed/amp/amp19.xml') { |feed|
126
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
127
+ }
122
128
  end
123
129
 
124
130
  def test_amp_20
125
- feed = FeedTools::Feed.open(
126
- 'http://feedparser.org/tests/wellformed/amp/amp20.xml')
127
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
131
+ with_feed(:from_file => 'wellformed/amp/amp20.xml') { |feed|
132
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
133
+ }
128
134
  end
129
135
 
130
136
  def test_amp_21
131
- feed = FeedTools::Feed.open(
132
- 'http://feedparser.org/tests/wellformed/amp/amp21.xml')
133
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
137
+ with_feed(:from_file => 'wellformed/amp/amp21.xml') { |feed|
138
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
139
+ }
134
140
  end
135
141
 
136
142
  def test_amp_22
137
- feed = FeedTools::Feed.open(
138
- 'http://feedparser.org/tests/wellformed/amp/amp22.xml')
139
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
143
+ with_feed(:from_file => 'wellformed/amp/amp22.xml') { |feed|
144
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
145
+ }
140
146
  end
141
147
 
142
148
  def test_amp_23
143
- feed = FeedTools::Feed.open(
144
- 'http://feedparser.org/tests/wellformed/amp/amp23.xml')
145
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
149
+ with_feed(:from_file => 'wellformed/amp/amp23.xml') { |feed|
150
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
151
+ }
146
152
  end
147
153
 
148
154
  def test_amp_24
149
- feed = FeedTools::Feed.open(
150
- 'http://feedparser.org/tests/wellformed/amp/amp24.xml')
151
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
155
+ with_feed(:from_file => 'wellformed/amp/amp24.xml') { |feed|
156
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
157
+ }
152
158
  end
153
159
 
154
160
  def test_amp_25
155
- feed = FeedTools::Feed.open(
156
- 'http://feedparser.org/tests/wellformed/amp/amp25.xml')
157
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
161
+ with_feed(:from_file => 'wellformed/amp/amp25.xml') { |feed|
162
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
163
+ }
158
164
  end
159
165
 
160
166
  def test_amp_26
161
- feed = FeedTools::Feed.open(
162
- 'http://feedparser.org/tests/wellformed/amp/amp26.xml')
163
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
167
+ with_feed(:from_file => 'wellformed/amp/amp26.xml') { |feed|
168
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
169
+ }
164
170
  end
165
171
 
166
172
  def test_amp_27
167
- feed = FeedTools::Feed.open(
168
- 'http://feedparser.org/tests/wellformed/amp/amp27.xml')
169
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
173
+ with_feed(:from_file => 'wellformed/amp/amp27.xml') { |feed|
174
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
175
+ }
170
176
  end
171
177
 
172
178
  def test_amp_28
173
- feed = FeedTools::Feed.open(
174
- 'http://feedparser.org/tests/wellformed/amp/amp28.xml')
175
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
179
+ with_feed(:from_file => 'wellformed/amp/amp28.xml') { |feed|
180
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
181
+ }
176
182
  end
177
183
 
178
184
  def test_amp_29
179
- feed = FeedTools::Feed.open(
180
- 'http://feedparser.org/tests/wellformed/amp/amp29.xml')
181
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
185
+ with_feed(:from_file => 'wellformed/amp/amp29.xml') { |feed|
186
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
187
+ }
182
188
  end
183
189
 
184
190
  def test_amp_30
185
- feed = FeedTools::Feed.open(
186
- 'http://feedparser.org/tests/wellformed/amp/amp30.xml')
187
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
191
+ with_feed(:from_file => 'wellformed/amp/amp30.xml') { |feed|
192
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
193
+ }
188
194
  end
189
195
 
190
196
  def test_amp_31
191
- feed = FeedTools::Feed.open(
192
- 'http://feedparser.org/tests/wellformed/amp/amp31.xml')
193
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
197
+ with_feed(:from_file => 'wellformed/amp/amp31.xml') { |feed|
198
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
199
+ }
194
200
  end
195
201
 
196
202
  def test_amp_32
197
- feed = FeedTools::Feed.open(
198
- 'http://feedparser.org/tests/wellformed/amp/amp32.xml')
199
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
203
+ with_feed(:from_file => 'wellformed/amp/amp32.xml') { |feed|
204
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
205
+ }
200
206
  end
201
207
 
202
208
  def test_amp_33
203
- feed = FeedTools::Feed.open(
204
- 'http://feedparser.org/tests/wellformed/amp/amp33.xml')
205
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
209
+ with_feed(:from_file => 'wellformed/amp/amp33.xml') { |feed|
210
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
211
+ }
206
212
  end
207
213
 
208
214
  def test_amp_34
209
- feed = FeedTools::Feed.open(
210
- 'http://feedparser.org/tests/wellformed/amp/amp34.xml')
211
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
215
+ with_feed(:from_file => 'wellformed/amp/amp34.xml') { |feed|
216
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
217
+ }
212
218
  end
213
219
 
214
220
  def test_amp_35
215
- feed = FeedTools::Feed.open(
216
- 'http://feedparser.org/tests/wellformed/amp/amp35.xml')
217
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
221
+ with_feed(:from_file => 'wellformed/amp/amp35.xml') { |feed|
222
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
223
+ }
218
224
  end
219
225
 
220
226
  def test_amp_36
221
- feed = FeedTools::Feed.open(
222
- 'http://feedparser.org/tests/wellformed/amp/amp36.xml')
223
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
227
+ with_feed(:from_file => 'wellformed/amp/amp36.xml') { |feed|
228
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
229
+ }
224
230
  end
225
231
 
226
232
  def test_amp_37
227
- feed = FeedTools::Feed.open(
228
- 'http://feedparser.org/tests/wellformed/amp/amp37.xml')
229
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
233
+ with_feed(:from_file => 'wellformed/amp/amp37.xml') { |feed|
234
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
235
+ }
230
236
  end
231
237
 
232
238
  def test_amp_38
233
- feed = FeedTools::Feed.open(
234
- 'http://feedparser.org/tests/wellformed/amp/amp38.xml')
235
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
239
+ with_feed(:from_file => 'wellformed/amp/amp38.xml') { |feed|
240
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
241
+ }
236
242
  end
237
243
 
238
244
  def test_amp_39
239
- feed = FeedTools::Feed.open(
240
- 'http://feedparser.org/tests/wellformed/amp/amp39.xml')
241
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
245
+ with_feed(:from_file => 'wellformed/amp/amp39.xml') { |feed|
246
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
247
+ }
242
248
  end
243
249
 
244
250
  def test_amp_40
245
- feed = FeedTools::Feed.open(
246
- 'http://feedparser.org/tests/wellformed/amp/amp40.xml')
247
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
251
+ with_feed(:from_file => 'wellformed/amp/amp40.xml') { |feed|
252
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
253
+ }
248
254
  end
249
255
 
250
256
  def test_amp_41
251
- feed = FeedTools::Feed.open(
252
- 'http://feedparser.org/tests/wellformed/amp/amp41.xml')
253
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
257
+ with_feed(:from_file => 'wellformed/amp/amp41.xml') { |feed|
258
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
259
+ }
254
260
  end
255
261
 
256
262
  def test_amp_42
257
- feed = FeedTools::Feed.open(
258
- 'http://feedparser.org/tests/wellformed/amp/amp42.xml')
259
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
263
+ with_feed(:from_file => 'wellformed/amp/amp42.xml') { |feed|
264
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
265
+ }
260
266
  end
261
267
 
262
268
  def test_amp_43
263
- feed = FeedTools::Feed.open(
264
- 'http://feedparser.org/tests/wellformed/amp/amp43.xml')
265
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
269
+ with_feed(:from_file => 'wellformed/amp/amp43.xml') { |feed|
270
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
271
+ }
266
272
  end
267
273
 
268
274
  def test_amp_44
269
- feed = FeedTools::Feed.open(
270
- 'http://feedparser.org/tests/wellformed/amp/amp44.xml')
271
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
275
+ with_feed(:from_file => 'wellformed/amp/amp44.xml') { |feed|
276
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
277
+ }
272
278
  end
273
279
 
274
280
  def test_amp_45
275
- feed = FeedTools::Feed.open(
276
- 'http://feedparser.org/tests/wellformed/amp/amp45.xml')
277
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
281
+ with_feed(:from_file => 'wellformed/amp/amp45.xml') { |feed|
282
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
283
+ }
278
284
  end
279
285
 
280
286
  def test_amp_46
281
- feed = FeedTools::Feed.open(
282
- 'http://feedparser.org/tests/wellformed/amp/amp46.xml')
283
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
287
+ with_feed(:from_file => 'wellformed/amp/amp46.xml') { |feed|
288
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
289
+ }
284
290
  end
285
291
 
286
292
  def test_amp_47
287
- feed = FeedTools::Feed.open(
288
- 'http://feedparser.org/tests/wellformed/amp/amp47.xml')
289
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
293
+ with_feed(:from_file => 'wellformed/amp/amp47.xml') { |feed|
294
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
295
+ }
290
296
  end
291
297
 
292
298
  def test_amp_48
293
- feed = FeedTools::Feed.open(
294
- 'http://feedparser.org/tests/wellformed/amp/amp48.xml')
295
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
299
+ with_feed(:from_file => 'wellformed/amp/amp48.xml') { |feed|
300
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
301
+ }
296
302
  end
297
303
 
298
304
  def test_amp_49
299
- feed = FeedTools::Feed.open(
300
- 'http://feedparser.org/tests/wellformed/amp/amp49.xml')
301
- assert_equal("&amp;", feed.entries.first.title)
305
+ with_feed(:from_file => 'wellformed/amp/amp49.xml') { |feed|
306
+ assert_equal("&amp;", feed.entries.first.title)
307
+ }
302
308
  end
303
309
 
304
310
  def test_amp_50
305
- feed = FeedTools::Feed.open(
306
- 'http://feedparser.org/tests/wellformed/amp/amp50.xml')
307
- assert_equal("&amp;", feed.entries.first.title)
311
+ with_feed(:from_file => 'wellformed/amp/amp50.xml') { |feed|
312
+ assert_equal("&amp;", feed.entries.first.title)
313
+ }
308
314
  end
309
315
 
310
316
  def test_amp_51
311
- feed = FeedTools::Feed.open(
312
- 'http://feedparser.org/tests/wellformed/amp/amp51.xml')
313
- assert_equal("&", feed.entries.first.title)
317
+ with_feed(:from_file => 'wellformed/amp/amp51.xml') { |feed|
318
+ assert_equal("&", feed.entries.first.title)
319
+ }
314
320
  end
315
321
 
316
322
  def test_amp_52
317
- feed = FeedTools::Feed.open(
318
- 'http://feedparser.org/tests/wellformed/amp/amp52.xml')
319
- assert_equal("&amp;", feed.entries.first.title)
323
+ with_feed(:from_file => 'wellformed/amp/amp52.xml') { |feed|
324
+ assert_equal("&amp;", feed.entries.first.title)
325
+ }
320
326
  end
321
327
 
322
328
  def test_amp_53
323
- feed = FeedTools::Feed.open(
324
- 'http://feedparser.org/tests/wellformed/amp/amp53.xml')
325
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
329
+ with_feed(:from_file => 'wellformed/amp/amp53.xml') { |feed|
330
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
331
+ }
326
332
  end
327
333
 
328
334
  def test_amp_54
329
- feed = FeedTools::Feed.open(
330
- 'http://feedparser.org/tests/wellformed/amp/amp54.xml')
331
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
335
+ with_feed(:from_file => 'wellformed/amp/amp54.xml') { |feed|
336
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
337
+ }
332
338
  end
333
339
 
334
340
  def test_amp_55
335
- feed = FeedTools::Feed.open(
336
- 'http://feedparser.org/tests/wellformed/amp/amp55.xml')
337
- assert_equal("<b>&amp;</b>", feed.entries.first.title)
341
+ with_feed(:from_file => 'wellformed/amp/amp55.xml') { |feed|
342
+ assert_equal("<b>&amp;</b>", feed.entries.first.title)
343
+ }
338
344
  end
339
345
 
340
346
  def test_amp_56
341
- feed = FeedTools::Feed.open(
342
- 'http://feedparser.org/tests/wellformed/amp/amp56.xml')
343
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
347
+ with_feed(:from_file => 'wellformed/amp/amp56.xml') { |feed|
348
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
349
+ }
344
350
  end
345
351
 
346
352
  def test_amp_57
347
- feed = FeedTools::Feed.open(
348
- 'http://feedparser.org/tests/wellformed/amp/amp57.xml')
349
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
353
+ with_feed(:from_file => 'wellformed/amp/amp57.xml') { |feed|
354
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
355
+ }
350
356
  end
351
357
 
352
358
  def test_amp_58
353
- feed = FeedTools::Feed.open(
354
- 'http://feedparser.org/tests/wellformed/amp/amp58.xml')
355
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
359
+ with_feed(:from_file => 'wellformed/amp/amp58.xml') { |feed|
360
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
361
+ }
356
362
  end
357
363
 
358
364
  def test_amp_59
359
- feed = FeedTools::Feed.open(
360
- 'http://feedparser.org/tests/wellformed/amp/amp59.xml')
361
- assert_equal("<div><b>&amp;</b></div>", feed.entries.first.title)
365
+ with_feed(:from_file => 'wellformed/amp/amp59.xml') { |feed|
366
+ assert_equal("<div><b>&amp;</b></div>", feed.entries.first.title)
367
+ }
362
368
  end
363
369
 
364
370
  def test_amp_60
365
- feed = FeedTools::Feed.open(
366
- 'http://feedparser.org/tests/wellformed/amp/amp60.xml')
367
- assert_equal("<div><b>&amp;</b></div>", feed.entries.first.title)
371
+ with_feed(:from_file => 'wellformed/amp/amp60.xml') { |feed|
372
+ assert_equal("<div><b>&amp;</b></div>", feed.entries.first.title)
373
+ }
368
374
  end
369
375
 
370
376
  def test_amp_61
371
- feed = FeedTools::Feed.open(
372
- 'http://feedparser.org/tests/wellformed/amp/amp61.xml')
373
- assert_equal("<div><b>&amp;</b></div>", feed.entries.first.title)
377
+ with_feed(:from_file => 'wellformed/amp/amp61.xml') { |feed|
378
+ assert_equal("<div><b>&amp;</b></div>", feed.entries.first.title)
379
+ }
374
380
  end
375
381
 
376
382
  def test_amp_62
377
- feed = FeedTools::Feed.open(
378
- 'http://feedparser.org/tests/wellformed/amp/amp62.xml')
379
- assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
383
+ with_feed(:from_file => 'wellformed/amp/amp62.xml') { |feed|
384
+ assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
385
+ }
380
386
  end
381
387
 
382
388
  def test_amp_63
383
- feed = FeedTools::Feed.open(
384
- 'http://feedparser.org/tests/wellformed/amp/amp63.xml')
385
- assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
389
+ with_feed(:from_file => 'wellformed/amp/amp63.xml') { |feed|
390
+ assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
391
+ }
386
392
  end
387
393
 
388
394
  def test_amp_64
389
- feed = FeedTools::Feed.open(
390
- 'http://feedparser.org/tests/wellformed/amp/amp64.xml')
391
- assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
395
+ with_feed(:from_file => 'wellformed/amp/amp64.xml') { |feed|
396
+ assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
397
+ }
392
398
  end
393
399
 
394
400
  def test_amp_65
395
- feed = FeedTools::Feed.new
396
- feed.feed_data = <<-FEED
401
+ with_feed(:from_data => <<-FEED
397
402
  <feed version="0.3">
398
403
  <title>&lt;strong>1 &amp;amp; 2 &amp; 3&lt;/strong></title>
399
404
  <tagline>&lt;strong>1 &amp;amp; 2 &amp; 3&lt;/strong></tagline>
@@ -403,594 +408,595 @@ class AmpTest < Test::Unit::TestCase
403
408
  </entry>
404
409
  </feed>
405
410
  FEED
406
- assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.title)
407
- assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.tagline)
408
- assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.entries.first.title)
409
- assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.entries.first.content)
411
+ ) { |feed|
412
+ assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.title)
413
+ assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.tagline)
414
+ assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.entries.first.title)
415
+ assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.entries.first.content)
416
+ }
410
417
  end
411
418
 
412
419
  def test_amp_tidy_01
413
420
  FeedTools.tidy_enabled = true
414
421
  assert_equal(true, FeedTools.tidy_enabled?,
415
422
  "Could not enable tidyhtml, library may be missing.")
416
- feed = FeedTools::Feed.open(
417
- 'http://feedparser.org/tests/wellformed/amp/amp01.xml')
418
- assert_equal("&amp;", feed.entries.first.title)
423
+ with_feed(:from_file => 'wellformed/amp/amp01.xml') { |feed|
424
+ assert_equal("&amp;", feed.entries.first.title)
425
+ }
419
426
  end
420
427
 
421
428
  def test_amp_tidy_02
422
429
  FeedTools.tidy_enabled = true
423
430
  assert_equal(true, FeedTools.tidy_enabled?,
424
431
  "Could not enable tidyhtml, library may be missing.")
425
- feed = FeedTools::Feed.open(
426
- 'http://feedparser.org/tests/wellformed/amp/amp02.xml')
427
- assert_equal("&amp;", feed.entries.first.title)
432
+ with_feed(:from_file => 'wellformed/amp/amp02.xml') { |feed|
433
+ assert_equal("&amp;", feed.entries.first.title)
434
+ }
428
435
  end
429
436
 
430
437
  def test_amp_tidy_03
431
438
  FeedTools.tidy_enabled = true
432
439
  assert_equal(true, FeedTools.tidy_enabled?,
433
440
  "Could not enable tidyhtml, library may be missing.")
434
- feed = FeedTools::Feed.open(
435
- 'http://feedparser.org/tests/wellformed/amp/amp03.xml')
436
- assert_equal("&", feed.entries.first.title)
441
+ with_feed(:from_file => 'wellformed/amp/amp03.xml') { |feed|
442
+ assert_equal("&", feed.entries.first.title)
443
+ }
437
444
  end
438
445
 
439
446
  def test_amp_tidy_04
440
447
  FeedTools.tidy_enabled = true
441
448
  assert_equal(true, FeedTools.tidy_enabled?,
442
449
  "Could not enable tidyhtml, library may be missing.")
443
- feed = FeedTools::Feed.open(
444
- 'http://feedparser.org/tests/wellformed/amp/amp04.xml')
445
- assert_equal("&amp;", feed.entries.first.title)
450
+ with_feed(:from_file => 'wellformed/amp/amp04.xml') { |feed|
451
+ assert_equal("&amp;", feed.entries.first.title)
452
+ }
446
453
  end
447
454
 
448
455
  def test_amp_tidy_05
449
456
  FeedTools.tidy_enabled = true
450
457
  assert_equal(true, FeedTools.tidy_enabled?,
451
458
  "Could not enable tidyhtml, library may be missing.")
452
- feed = FeedTools::Feed.open(
453
- 'http://feedparser.org/tests/wellformed/amp/amp05.xml')
454
- assert_equal("&amp;", feed.entries.first.title)
459
+ with_feed(:from_file => 'wellformed/amp/amp05.xml') { |feed|
460
+ assert_equal("&amp;", feed.entries.first.title)
461
+ }
455
462
  end
456
463
 
457
464
  def test_amp_tidy_06
458
465
  FeedTools.tidy_enabled = true
459
466
  assert_equal(true, FeedTools.tidy_enabled?,
460
467
  "Could not enable tidyhtml, library may be missing.")
461
- feed = FeedTools::Feed.open(
462
- 'http://feedparser.org/tests/wellformed/amp/amp06.xml')
463
- assert_equal("&amp;", feed.entries.first.title)
468
+ with_feed(:from_file => 'wellformed/amp/amp06.xml') { |feed|
469
+ assert_equal("&amp;", feed.entries.first.title)
470
+ }
464
471
  end
465
472
 
466
473
  def test_amp_tidy_07
467
474
  FeedTools.tidy_enabled = true
468
475
  assert_equal(true, FeedTools.tidy_enabled?,
469
476
  "Could not enable tidyhtml, library may be missing.")
470
- feed = FeedTools::Feed.open(
471
- 'http://feedparser.org/tests/wellformed/amp/amp07.xml')
472
- assert_equal("&", feed.entries.first.title)
477
+ with_feed(:from_file => 'wellformed/amp/amp07.xml') { |feed|
478
+ assert_equal("&", feed.entries.first.title)
479
+ }
473
480
  end
474
481
 
475
482
  def test_amp_tidy_08
476
483
  FeedTools.tidy_enabled = true
477
484
  assert_equal(true, FeedTools.tidy_enabled?,
478
485
  "Could not enable tidyhtml, library may be missing.")
479
- feed = FeedTools::Feed.open(
480
- 'http://feedparser.org/tests/wellformed/amp/amp08.xml')
481
- assert_equal("&amp;", feed.entries.first.title)
486
+ with_feed(:from_file => 'wellformed/amp/amp08.xml') { |feed|
487
+ assert_equal("&amp;", feed.entries.first.title)
488
+ }
482
489
  end
483
490
 
484
491
  def test_amp_tidy_09
485
492
  FeedTools.tidy_enabled = true
486
493
  assert_equal(true, FeedTools.tidy_enabled?,
487
494
  "Could not enable tidyhtml, library may be missing.")
488
- feed = FeedTools::Feed.open(
489
- 'http://feedparser.org/tests/wellformed/amp/amp09.xml')
490
- assert_equal("&amp;", feed.entries.first.title)
495
+ with_feed(:from_file => 'wellformed/amp/amp09.xml') { |feed|
496
+ assert_equal("&amp;", feed.entries.first.title)
497
+ }
491
498
  end
492
499
 
493
500
  def test_amp_tidy_10
494
501
  FeedTools.tidy_enabled = true
495
502
  assert_equal(true, FeedTools.tidy_enabled?,
496
503
  "Could not enable tidyhtml, library may be missing.")
497
- feed = FeedTools::Feed.open(
498
- 'http://feedparser.org/tests/wellformed/amp/amp10.xml')
499
- assert_equal("&amp;", feed.entries.first.title)
504
+ with_feed(:from_file => 'wellformed/amp/amp10.xml') { |feed|
505
+ assert_equal("&amp;", feed.entries.first.title)
506
+ }
500
507
  end
501
508
 
502
509
  def test_amp_tidy_11
503
510
  FeedTools.tidy_enabled = true
504
511
  assert_equal(true, FeedTools.tidy_enabled?,
505
512
  "Could not enable tidyhtml, library may be missing.")
506
- feed = FeedTools::Feed.open(
507
- 'http://feedparser.org/tests/wellformed/amp/amp11.xml')
508
- assert_equal("&", feed.entries.first.title)
513
+ with_feed(:from_file => 'wellformed/amp/amp11.xml') { |feed|
514
+ assert_equal("&", feed.entries.first.title)
515
+ }
509
516
  end
510
517
 
511
518
  def test_amp_tidy_12
512
519
  FeedTools.tidy_enabled = true
513
520
  assert_equal(true, FeedTools.tidy_enabled?,
514
521
  "Could not enable tidyhtml, library may be missing.")
515
- feed = FeedTools::Feed.open(
516
- 'http://feedparser.org/tests/wellformed/amp/amp12.xml')
517
- assert_equal("&amp;", feed.entries.first.title)
522
+ with_feed(:from_file => 'wellformed/amp/amp12.xml') { |feed|
523
+ assert_equal("&amp;", feed.entries.first.title)
524
+ }
518
525
  end
519
526
 
520
527
  def test_amp_tidy_13
521
528
  FeedTools.tidy_enabled = true
522
529
  assert_equal(true, FeedTools.tidy_enabled?,
523
530
  "Could not enable tidyhtml, library may be missing.")
524
- feed = FeedTools::Feed.open(
525
- 'http://feedparser.org/tests/wellformed/amp/amp13.xml')
526
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
531
+ with_feed(:from_file => 'wellformed/amp/amp13.xml') { |feed|
532
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
533
+ }
527
534
  end
528
535
 
529
536
  def test_amp_tidy_14
530
537
  FeedTools.tidy_enabled = true
531
538
  assert_equal(true, FeedTools.tidy_enabled?,
532
539
  "Could not enable tidyhtml, library may be missing.")
533
- feed = FeedTools::Feed.open(
534
- 'http://feedparser.org/tests/wellformed/amp/amp14.xml')
535
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
540
+ with_feed(:from_file => 'wellformed/amp/amp14.xml') { |feed|
541
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
542
+ }
536
543
  end
537
544
 
538
545
  def test_amp_tidy_15
539
546
  FeedTools.tidy_enabled = true
540
547
  assert_equal(true, FeedTools.tidy_enabled?,
541
548
  "Could not enable tidyhtml, library may be missing.")
542
- feed = FeedTools::Feed.open(
543
- 'http://feedparser.org/tests/wellformed/amp/amp15.xml')
544
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
549
+ with_feed(:from_file => 'wellformed/amp/amp15.xml') { |feed|
550
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
551
+ }
545
552
  end
546
553
 
547
554
  def test_amp_tidy_16
548
555
  FeedTools.tidy_enabled = true
549
556
  assert_equal(true, FeedTools.tidy_enabled?,
550
557
  "Could not enable tidyhtml, library may be missing.")
551
- feed = FeedTools::Feed.open(
552
- 'http://feedparser.org/tests/wellformed/amp/amp16.xml')
553
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
558
+ with_feed(:from_file => 'wellformed/amp/amp16.xml') { |feed|
559
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
560
+ }
554
561
  end
555
562
 
556
563
  def test_amp_tidy_17
557
564
  FeedTools.tidy_enabled = true
558
565
  assert_equal(true, FeedTools.tidy_enabled?,
559
566
  "Could not enable tidyhtml, library may be missing.")
560
- feed = FeedTools::Feed.open(
561
- 'http://feedparser.org/tests/wellformed/amp/amp17.xml')
562
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
567
+ with_feed(:from_file => 'wellformed/amp/amp17.xml') { |feed|
568
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
569
+ }
563
570
  end
564
571
 
565
572
  def test_amp_tidy_18
566
573
  FeedTools.tidy_enabled = true
567
574
  assert_equal(true, FeedTools.tidy_enabled?,
568
575
  "Could not enable tidyhtml, library may be missing.")
569
- feed = FeedTools::Feed.open(
570
- 'http://feedparser.org/tests/wellformed/amp/amp18.xml')
571
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
576
+ with_feed(:from_file => 'wellformed/amp/amp18.xml') { |feed|
577
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
578
+ }
572
579
  end
573
580
 
574
581
  def test_amp_tidy_19
575
582
  FeedTools.tidy_enabled = true
576
583
  assert_equal(true, FeedTools.tidy_enabled?,
577
584
  "Could not enable tidyhtml, library may be missing.")
578
- feed = FeedTools::Feed.open(
579
- 'http://feedparser.org/tests/wellformed/amp/amp19.xml')
580
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
585
+ with_feed(:from_file => 'wellformed/amp/amp19.xml') { |feed|
586
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
587
+ }
581
588
  end
582
589
 
583
590
  def test_amp_tidy_20
584
591
  FeedTools.tidy_enabled = true
585
592
  assert_equal(true, FeedTools.tidy_enabled?,
586
593
  "Could not enable tidyhtml, library may be missing.")
587
- feed = FeedTools::Feed.open(
588
- 'http://feedparser.org/tests/wellformed/amp/amp20.xml')
589
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
594
+ with_feed(:from_file => 'wellformed/amp/amp20.xml') { |feed|
595
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
596
+ }
590
597
  end
591
598
 
592
599
  def test_amp_tidy_21
593
600
  FeedTools.tidy_enabled = true
594
601
  assert_equal(true, FeedTools.tidy_enabled?,
595
602
  "Could not enable tidyhtml, library may be missing.")
596
- feed = FeedTools::Feed.open(
597
- 'http://feedparser.org/tests/wellformed/amp/amp21.xml')
598
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
603
+ with_feed(:from_file => 'wellformed/amp/amp21.xml') { |feed|
604
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
605
+ }
599
606
  end
600
607
 
601
608
  def test_amp_tidy_22
602
609
  FeedTools.tidy_enabled = true
603
610
  assert_equal(true, FeedTools.tidy_enabled?,
604
611
  "Could not enable tidyhtml, library may be missing.")
605
- feed = FeedTools::Feed.open(
606
- 'http://feedparser.org/tests/wellformed/amp/amp22.xml')
607
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
612
+ with_feed(:from_file => 'wellformed/amp/amp22.xml') { |feed|
613
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
614
+ }
608
615
  end
609
616
 
610
617
  def test_amp_tidy_23
611
618
  FeedTools.tidy_enabled = true
612
619
  assert_equal(true, FeedTools.tidy_enabled?,
613
620
  "Could not enable tidyhtml, library may be missing.")
614
- feed = FeedTools::Feed.open(
615
- 'http://feedparser.org/tests/wellformed/amp/amp23.xml')
616
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
621
+ with_feed(:from_file => 'wellformed/amp/amp23.xml') { |feed|
622
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
623
+ }
617
624
  end
618
625
 
619
626
  def test_amp_tidy_24
620
627
  FeedTools.tidy_enabled = true
621
628
  assert_equal(true, FeedTools.tidy_enabled?,
622
629
  "Could not enable tidyhtml, library may be missing.")
623
- feed = FeedTools::Feed.open(
624
- 'http://feedparser.org/tests/wellformed/amp/amp24.xml')
625
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
630
+ with_feed(:from_file => 'wellformed/amp/amp24.xml') { |feed|
631
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
632
+ }
626
633
  end
627
634
 
628
635
  def test_amp_tidy_25
629
636
  FeedTools.tidy_enabled = true
630
637
  assert_equal(true, FeedTools.tidy_enabled?,
631
638
  "Could not enable tidyhtml, library may be missing.")
632
- feed = FeedTools::Feed.open(
633
- 'http://feedparser.org/tests/wellformed/amp/amp25.xml')
634
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
639
+ with_feed(:from_file => 'wellformed/amp/amp25.xml') { |feed|
640
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
641
+ }
635
642
  end
636
643
 
637
644
  def test_amp_tidy_26
638
645
  FeedTools.tidy_enabled = true
639
646
  assert_equal(true, FeedTools.tidy_enabled?,
640
647
  "Could not enable tidyhtml, library may be missing.")
641
- feed = FeedTools::Feed.open(
642
- 'http://feedparser.org/tests/wellformed/amp/amp26.xml')
643
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
648
+ with_feed(:from_file => 'wellformed/amp/amp26.xml') { |feed|
649
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
650
+ }
644
651
  end
645
652
 
646
653
  def test_amp_tidy_27
647
654
  FeedTools.tidy_enabled = true
648
655
  assert_equal(true, FeedTools.tidy_enabled?,
649
656
  "Could not enable tidyhtml, library may be missing.")
650
- feed = FeedTools::Feed.open(
651
- 'http://feedparser.org/tests/wellformed/amp/amp27.xml')
652
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
657
+ with_feed(:from_file => 'wellformed/amp/amp27.xml') { |feed|
658
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
659
+ }
653
660
  end
654
661
 
655
662
  def test_amp_tidy_28
656
663
  FeedTools.tidy_enabled = true
657
664
  assert_equal(true, FeedTools.tidy_enabled?,
658
665
  "Could not enable tidyhtml, library may be missing.")
659
- feed = FeedTools::Feed.open(
660
- 'http://feedparser.org/tests/wellformed/amp/amp28.xml')
661
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
666
+ with_feed(:from_file => 'wellformed/amp/amp28.xml') { |feed|
667
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
668
+ }
662
669
  end
663
670
 
664
671
  def test_amp_tidy_29
665
672
  FeedTools.tidy_enabled = true
666
673
  assert_equal(true, FeedTools.tidy_enabled?,
667
674
  "Could not enable tidyhtml, library may be missing.")
668
- feed = FeedTools::Feed.open(
669
- 'http://feedparser.org/tests/wellformed/amp/amp29.xml')
670
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
675
+ with_feed(:from_file => 'wellformed/amp/amp29.xml') { |feed|
676
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
677
+ }
671
678
  end
672
679
 
673
680
  def test_amp_tidy_30
674
681
  FeedTools.tidy_enabled = true
675
682
  assert_equal(true, FeedTools.tidy_enabled?,
676
683
  "Could not enable tidyhtml, library may be missing.")
677
- feed = FeedTools::Feed.open(
678
- 'http://feedparser.org/tests/wellformed/amp/amp30.xml')
679
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
684
+ with_feed(:from_file => 'wellformed/amp/amp30.xml') { |feed|
685
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
686
+ }
680
687
  end
681
688
 
682
689
  def test_amp_tidy_31
683
690
  FeedTools.tidy_enabled = true
684
691
  assert_equal(true, FeedTools.tidy_enabled?,
685
692
  "Could not enable tidyhtml, library may be missing.")
686
- feed = FeedTools::Feed.open(
687
- 'http://feedparser.org/tests/wellformed/amp/amp31.xml')
688
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
693
+ with_feed(:from_file => 'wellformed/amp/amp31.xml') { |feed|
694
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
695
+ }
689
696
  end
690
697
 
691
698
  def test_amp_tidy_32
692
699
  FeedTools.tidy_enabled = true
693
700
  assert_equal(true, FeedTools.tidy_enabled?,
694
701
  "Could not enable tidyhtml, library may be missing.")
695
- feed = FeedTools::Feed.open(
696
- 'http://feedparser.org/tests/wellformed/amp/amp32.xml')
697
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
702
+ with_feed(:from_file => 'wellformed/amp/amp32.xml') { |feed|
703
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
704
+ }
698
705
  end
699
706
 
700
707
  def test_amp_tidy_33
701
708
  FeedTools.tidy_enabled = true
702
709
  assert_equal(true, FeedTools.tidy_enabled?,
703
710
  "Could not enable tidyhtml, library may be missing.")
704
- feed = FeedTools::Feed.open(
705
- 'http://feedparser.org/tests/wellformed/amp/amp33.xml')
706
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
711
+ with_feed(:from_file => 'wellformed/amp/amp33.xml') { |feed|
712
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
713
+ }
707
714
  end
708
715
 
709
716
  def test_amp_tidy_34
710
717
  FeedTools.tidy_enabled = true
711
718
  assert_equal(true, FeedTools.tidy_enabled?,
712
719
  "Could not enable tidyhtml, library may be missing.")
713
- feed = FeedTools::Feed.open(
714
- 'http://feedparser.org/tests/wellformed/amp/amp34.xml')
715
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
720
+ with_feed(:from_file => 'wellformed/amp/amp34.xml') { |feed|
721
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
722
+ }
716
723
  end
717
724
 
718
725
  def test_amp_tidy_35
719
726
  FeedTools.tidy_enabled = true
720
727
  assert_equal(true, FeedTools.tidy_enabled?,
721
728
  "Could not enable tidyhtml, library may be missing.")
722
- feed = FeedTools::Feed.open(
723
- 'http://feedparser.org/tests/wellformed/amp/amp35.xml')
724
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
729
+ with_feed(:from_file => 'wellformed/amp/amp35.xml') { |feed|
730
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
731
+ }
725
732
  end
726
733
 
727
734
  def test_amp_tidy_36
728
735
  FeedTools.tidy_enabled = true
729
736
  assert_equal(true, FeedTools.tidy_enabled?,
730
737
  "Could not enable tidyhtml, library may be missing.")
731
- feed = FeedTools::Feed.open(
732
- 'http://feedparser.org/tests/wellformed/amp/amp36.xml')
733
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
738
+ with_feed(:from_file => 'wellformed/amp/amp36.xml') { |feed|
739
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
740
+ }
734
741
  end
735
742
 
736
743
  def test_amp_tidy_37
737
744
  FeedTools.tidy_enabled = true
738
745
  assert_equal(true, FeedTools.tidy_enabled?,
739
746
  "Could not enable tidyhtml, library may be missing.")
740
- feed = FeedTools::Feed.open(
741
- 'http://feedparser.org/tests/wellformed/amp/amp37.xml')
742
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
747
+ with_feed(:from_file => 'wellformed/amp/amp37.xml') { |feed|
748
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
749
+ }
743
750
  end
744
751
 
745
752
  def test_amp_tidy_38
746
753
  FeedTools.tidy_enabled = true
747
754
  assert_equal(true, FeedTools.tidy_enabled?,
748
755
  "Could not enable tidyhtml, library may be missing.")
749
- feed = FeedTools::Feed.open(
750
- 'http://feedparser.org/tests/wellformed/amp/amp38.xml')
751
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
756
+ with_feed(:from_file => 'wellformed/amp/amp38.xml') { |feed|
757
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
758
+ }
752
759
  end
753
760
 
754
761
  def test_amp_tidy_39
755
762
  FeedTools.tidy_enabled = true
756
763
  assert_equal(true, FeedTools.tidy_enabled?,
757
764
  "Could not enable tidyhtml, library may be missing.")
758
- feed = FeedTools::Feed.open(
759
- 'http://feedparser.org/tests/wellformed/amp/amp39.xml')
760
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
765
+ with_feed(:from_file => 'wellformed/amp/amp39.xml') { |feed|
766
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
767
+ }
761
768
  end
762
769
 
763
770
  def test_amp_tidy_40
764
771
  FeedTools.tidy_enabled = true
765
772
  assert_equal(true, FeedTools.tidy_enabled?,
766
773
  "Could not enable tidyhtml, library may be missing.")
767
- feed = FeedTools::Feed.open(
768
- 'http://feedparser.org/tests/wellformed/amp/amp40.xml')
769
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
774
+ with_feed(:from_file => 'wellformed/amp/amp40.xml') { |feed|
775
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
776
+ }
770
777
  end
771
778
 
772
779
  def test_amp_tidy_41
773
780
  FeedTools.tidy_enabled = true
774
781
  assert_equal(true, FeedTools.tidy_enabled?,
775
782
  "Could not enable tidyhtml, library may be missing.")
776
- feed = FeedTools::Feed.open(
777
- 'http://feedparser.org/tests/wellformed/amp/amp41.xml')
778
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
783
+ with_feed(:from_file => 'wellformed/amp/amp41.xml') { |feed|
784
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
785
+ }
779
786
  end
780
787
 
781
788
  def test_amp_tidy_42
782
789
  FeedTools.tidy_enabled = true
783
790
  assert_equal(true, FeedTools.tidy_enabled?,
784
791
  "Could not enable tidyhtml, library may be missing.")
785
- feed = FeedTools::Feed.open(
786
- 'http://feedparser.org/tests/wellformed/amp/amp42.xml')
787
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
792
+ with_feed(:from_file => 'wellformed/amp/amp42.xml') { |feed|
793
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
794
+ }
788
795
  end
789
796
 
790
797
  def test_amp_tidy_43
791
798
  FeedTools.tidy_enabled = true
792
799
  assert_equal(true, FeedTools.tidy_enabled?,
793
800
  "Could not enable tidyhtml, library may be missing.")
794
- feed = FeedTools::Feed.open(
795
- 'http://feedparser.org/tests/wellformed/amp/amp43.xml')
796
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
801
+ with_feed(:from_file => 'wellformed/amp/amp43.xml') { |feed|
802
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
803
+ }
797
804
  end
798
805
 
799
806
  def test_amp_tidy_44
800
807
  FeedTools.tidy_enabled = true
801
808
  assert_equal(true, FeedTools.tidy_enabled?,
802
809
  "Could not enable tidyhtml, library may be missing.")
803
- feed = FeedTools::Feed.open(
804
- 'http://feedparser.org/tests/wellformed/amp/amp44.xml')
805
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
810
+ with_feed(:from_file => 'wellformed/amp/amp44.xml') { |feed|
811
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
812
+ }
806
813
  end
807
814
 
808
815
  def test_amp_tidy_45
809
816
  FeedTools.tidy_enabled = true
810
817
  assert_equal(true, FeedTools.tidy_enabled?,
811
818
  "Could not enable tidyhtml, library may be missing.")
812
- feed = FeedTools::Feed.open(
813
- 'http://feedparser.org/tests/wellformed/amp/amp45.xml')
814
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
819
+ with_feed(:from_file => 'wellformed/amp/amp45.xml') { |feed|
820
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
821
+ }
815
822
  end
816
823
 
817
824
  def test_amp_tidy_46
818
825
  FeedTools.tidy_enabled = true
819
826
  assert_equal(true, FeedTools.tidy_enabled?,
820
827
  "Could not enable tidyhtml, library may be missing.")
821
- feed = FeedTools::Feed.open(
822
- 'http://feedparser.org/tests/wellformed/amp/amp46.xml')
823
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
828
+ with_feed(:from_file => 'wellformed/amp/amp46.xml') { |feed|
829
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
830
+ }
824
831
  end
825
832
 
826
833
  def test_amp_tidy_47
827
834
  FeedTools.tidy_enabled = true
828
835
  assert_equal(true, FeedTools.tidy_enabled?,
829
836
  "Could not enable tidyhtml, library may be missing.")
830
- feed = FeedTools::Feed.open(
831
- 'http://feedparser.org/tests/wellformed/amp/amp47.xml')
832
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
837
+ with_feed(:from_file => 'wellformed/amp/amp47.xml') { |feed|
838
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
839
+ }
833
840
  end
834
841
 
835
842
  def test_amp_tidy_48
836
843
  FeedTools.tidy_enabled = true
837
844
  assert_equal(true, FeedTools.tidy_enabled?,
838
845
  "Could not enable tidyhtml, library may be missing.")
839
- feed = FeedTools::Feed.open(
840
- 'http://feedparser.org/tests/wellformed/amp/amp48.xml')
841
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
846
+ with_feed(:from_file => 'wellformed/amp/amp48.xml') { |feed|
847
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
848
+ }
842
849
  end
843
850
 
844
851
  def test_amp_tidy_49
845
852
  FeedTools.tidy_enabled = true
846
853
  assert_equal(true, FeedTools.tidy_enabled?,
847
854
  "Could not enable tidyhtml, library may be missing.")
848
- feed = FeedTools::Feed.open(
849
- 'http://feedparser.org/tests/wellformed/amp/amp49.xml')
850
- assert_equal("&amp;", feed.entries.first.title)
855
+ with_feed(:from_file => 'wellformed/amp/amp49.xml') { |feed|
856
+ assert_equal("&amp;", feed.entries.first.title)
857
+ }
851
858
  end
852
859
 
853
860
  def test_amp_tidy_50
854
861
  FeedTools.tidy_enabled = true
855
862
  assert_equal(true, FeedTools.tidy_enabled?,
856
863
  "Could not enable tidyhtml, library may be missing.")
857
- feed = FeedTools::Feed.open(
858
- 'http://feedparser.org/tests/wellformed/amp/amp50.xml')
859
- assert_equal("&amp;", feed.entries.first.title)
864
+ with_feed(:from_file => 'wellformed/amp/amp50.xml') { |feed|
865
+ assert_equal("&amp;", feed.entries.first.title)
866
+ }
860
867
  end
861
868
 
862
869
  def test_amp_tidy_51
863
870
  FeedTools.tidy_enabled = true
864
871
  assert_equal(true, FeedTools.tidy_enabled?,
865
872
  "Could not enable tidyhtml, library may be missing.")
866
- feed = FeedTools::Feed.open(
867
- 'http://feedparser.org/tests/wellformed/amp/amp51.xml')
868
- assert_equal("&", feed.entries.first.title)
873
+ with_feed(:from_file => 'wellformed/amp/amp51.xml') { |feed|
874
+ assert_equal("&", feed.entries.first.title)
875
+ }
869
876
  end
870
877
 
871
878
  def test_amp_tidy_52
872
879
  FeedTools.tidy_enabled = true
873
880
  assert_equal(true, FeedTools.tidy_enabled?,
874
881
  "Could not enable tidyhtml, library may be missing.")
875
- feed = FeedTools::Feed.open(
876
- 'http://feedparser.org/tests/wellformed/amp/amp52.xml')
877
- assert_equal("&amp;", feed.entries.first.title)
882
+ with_feed(:from_file => 'wellformed/amp/amp52.xml') { |feed|
883
+ assert_equal("&amp;", feed.entries.first.title)
884
+ }
878
885
  end
879
886
 
880
887
  def test_amp_tidy_53
881
888
  FeedTools.tidy_enabled = true
882
889
  assert_equal(true, FeedTools.tidy_enabled?,
883
890
  "Could not enable tidyhtml, library may be missing.")
884
- feed = FeedTools::Feed.open(
885
- 'http://feedparser.org/tests/wellformed/amp/amp53.xml')
886
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
891
+ with_feed(:from_file => 'wellformed/amp/amp53.xml') { |feed|
892
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
893
+ }
887
894
  end
888
895
 
889
896
  def test_amp_tidy_54
890
897
  FeedTools.tidy_enabled = true
891
898
  assert_equal(true, FeedTools.tidy_enabled?,
892
899
  "Could not enable tidyhtml, library may be missing.")
893
- feed = FeedTools::Feed.open(
894
- 'http://feedparser.org/tests/wellformed/amp/amp54.xml')
895
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
900
+ with_feed(:from_file => 'wellformed/amp/amp54.xml') { |feed|
901
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
902
+ }
896
903
  end
897
904
 
898
905
  def test_amp_tidy_55
899
906
  FeedTools.tidy_enabled = true
900
907
  assert_equal(true, FeedTools.tidy_enabled?,
901
908
  "Could not enable tidyhtml, library may be missing.")
902
- feed = FeedTools::Feed.open(
903
- 'http://feedparser.org/tests/wellformed/amp/amp55.xml')
904
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
909
+ with_feed(:from_file => 'wellformed/amp/amp55.xml') { |feed|
910
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
911
+ }
905
912
  end
906
913
 
907
914
  def test_amp_tidy_56
908
915
  FeedTools.tidy_enabled = true
909
916
  assert_equal(true, FeedTools.tidy_enabled?,
910
917
  "Could not enable tidyhtml, library may be missing.")
911
- feed = FeedTools::Feed.open(
912
- 'http://feedparser.org/tests/wellformed/amp/amp56.xml')
913
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
918
+ with_feed(:from_file => 'wellformed/amp/amp56.xml') { |feed|
919
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
920
+ }
914
921
  end
915
922
 
916
923
  def test_amp_tidy_57
917
924
  FeedTools.tidy_enabled = true
918
925
  assert_equal(true, FeedTools.tidy_enabled?,
919
926
  "Could not enable tidyhtml, library may be missing.")
920
- feed = FeedTools::Feed.open(
921
- 'http://feedparser.org/tests/wellformed/amp/amp57.xml')
922
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
927
+ with_feed(:from_file => 'wellformed/amp/amp57.xml') { |feed|
928
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
929
+ }
923
930
  end
924
931
 
925
932
  def test_amp_tidy_58
926
933
  FeedTools.tidy_enabled = true
927
934
  assert_equal(true, FeedTools.tidy_enabled?,
928
935
  "Could not enable tidyhtml, library may be missing.")
929
- feed = FeedTools::Feed.open(
930
- 'http://feedparser.org/tests/wellformed/amp/amp58.xml')
931
- assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
936
+ with_feed(:from_file => 'wellformed/amp/amp58.xml') { |feed|
937
+ assert_equal("<strong>&amp;</strong>", feed.entries.first.title)
938
+ }
932
939
  end
933
940
 
934
941
  def test_amp_tidy_59
935
942
  FeedTools.tidy_enabled = true
936
943
  assert_equal(true, FeedTools.tidy_enabled?,
937
944
  "Could not enable tidyhtml, library may be missing.")
938
- feed = FeedTools::Feed.open(
939
- 'http://feedparser.org/tests/wellformed/amp/amp59.xml')
940
- assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
945
+ with_feed(:from_file => 'wellformed/amp/amp59.xml') { |feed|
946
+ assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
947
+ }
941
948
  end
942
949
 
943
950
  def test_amp_tidy_60
944
951
  FeedTools.tidy_enabled = true
945
952
  assert_equal(true, FeedTools.tidy_enabled?,
946
953
  "Could not enable tidyhtml, library may be missing.")
947
- feed = FeedTools::Feed.open(
948
- 'http://feedparser.org/tests/wellformed/amp/amp60.xml')
949
- assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
954
+ with_feed(:from_file => 'wellformed/amp/amp60.xml') { |feed|
955
+ assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
956
+ }
950
957
  end
951
958
 
952
959
  def test_amp_tidy_61
953
960
  FeedTools.tidy_enabled = true
954
961
  assert_equal(true, FeedTools.tidy_enabled?,
955
962
  "Could not enable tidyhtml, library may be missing.")
956
- feed = FeedTools::Feed.open(
957
- 'http://feedparser.org/tests/wellformed/amp/amp61.xml')
958
- assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
963
+ with_feed(:from_file => 'wellformed/amp/amp61.xml') { |feed|
964
+ assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
965
+ }
959
966
  end
960
967
 
961
968
  def test_amp_tidy_62
962
969
  FeedTools.tidy_enabled = true
963
970
  assert_equal(true, FeedTools.tidy_enabled?,
964
971
  "Could not enable tidyhtml, library may be missing.")
965
- feed = FeedTools::Feed.open(
966
- 'http://feedparser.org/tests/wellformed/amp/amp62.xml')
967
- assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
972
+ with_feed(:from_file => 'wellformed/amp/amp62.xml') { |feed|
973
+ assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
974
+ }
968
975
  end
969
976
 
970
977
  def test_amp_tidy_63
971
978
  FeedTools.tidy_enabled = true
972
979
  assert_equal(true, FeedTools.tidy_enabled?,
973
980
  "Could not enable tidyhtml, library may be missing.")
974
- feed = FeedTools::Feed.open(
975
- 'http://feedparser.org/tests/wellformed/amp/amp63.xml')
976
- assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
981
+ with_feed(:from_file => 'wellformed/amp/amp63.xml') { |feed|
982
+ assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
983
+ }
977
984
  end
978
985
 
979
986
  def test_amp_tidy_64
980
987
  FeedTools.tidy_enabled = true
981
988
  assert_equal(true, FeedTools.tidy_enabled?,
982
989
  "Could not enable tidyhtml, library may be missing.")
983
- feed = FeedTools::Feed.open(
984
- 'http://feedparser.org/tests/wellformed/amp/amp64.xml')
985
- assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
990
+ with_feed(:from_file => 'wellformed/amp/amp64.xml') { |feed|
991
+ assert_equal("<div><strong>&amp;</strong></div>", feed.entries.first.title)
992
+ }
986
993
  end
987
994
 
988
995
  def test_amp_tidy_65
989
996
  FeedTools.tidy_enabled = true
990
997
  assert_equal(true, FeedTools.tidy_enabled?,
991
998
  "Could not enable tidyhtml, library may be missing.")
992
- feed = FeedTools::Feed.new
993
- feed.feed_data = <<-FEED
999
+ with_feed(:from_data => <<-FEED
994
1000
  <feed version="0.3">
995
1001
  <title>&lt;strong>1 &amp;amp; 2 &amp; 3&lt;/strong></title>
996
1002
  <tagline>&lt;strong>1 &amp;amp; 2 &amp; 3&lt;/strong></tagline>
@@ -1000,9 +1006,11 @@ class AmpTest < Test::Unit::TestCase
1000
1006
  </entry>
1001
1007
  </feed>
1002
1008
  FEED
1003
- assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.title)
1004
- assert_equal("<strong>1 &amp; 2 &amp; 3</strong>", feed.tagline)
1005
- assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.entries.first.title)
1006
- assert_equal("<strong>1 &amp; 2 &amp; 3</strong>", feed.entries.first.content)
1007
- end
1008
- end
1009
+ ) { |feed|
1010
+ assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.title)
1011
+ assert_equal("<strong>1 &amp; 2 &amp; 3</strong>", feed.tagline)
1012
+ assert_equal("<strong>1 &amp; 2 & 3</strong>", feed.entries.first.title)
1013
+ assert_equal("<strong>1 &amp; 2 &amp; 3</strong>", feed.entries.first.content)
1014
+ }
1015
+ end
1016
+ end