feedutils 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,8 +22,13 @@ def parse_feed( url )
22
22
  end
23
23
 
24
24
 
25
+
26
+ def read_feed_from_file( name )
27
+ File.read( "#{FeedUtils.root}/test/feeds/#{name}")
28
+ end
29
+
25
30
  def parse_feed_from_file( name )
26
- xml = File.read( "#{FeedUtils.root}/test/feeds/#{name}")
31
+ xml = read_feed_from_file( name )
27
32
 
28
33
  FeedUtils::Parser.parse( xml )
29
34
  end
@@ -0,0 +1,41 @@
1
+ ###
2
+ # to run use
3
+ # ruby -I ./lib -I ./test test/test_atom_v03.rb
4
+ # or better
5
+ # rake test
6
+
7
+ require 'helper'
8
+
9
+
10
+ class TestAtomV03 < MiniTest::Test
11
+
12
+ def test_match
13
+ xmlv1 = read_feed_from_file( 'googlegroups.atom' )
14
+ xmlv03 = read_feed_from_file( 'quirksblog.atom.v03' )
15
+
16
+ atomv03helper = FeedUtils::AtomV03Helper.new
17
+
18
+ assert_equal false, atomv03helper.match?( xmlv1 )
19
+ assert_equal true, atomv03helper.match?( xmlv03 )
20
+
21
+ xmlv03up = atomv03helper.convert( xmlv03 )
22
+ assert_equal false, atomv03helper.match?( xmlv03up )
23
+
24
+ pp xmlv03up[0..1000]
25
+ end
26
+
27
+ def test_parse
28
+ feed = parse_feed_from_file( 'quirksblog.atom.v03' )
29
+
30
+ pp feed.updated
31
+ assert_equal '2014-12-31T15:33:00+00:00', feed.updated.to_s
32
+
33
+ pp feed.items[0].updated
34
+ assert_equal '2014-12-31T15:33:00+00:00', feed.items[0].updated.to_s
35
+
36
+ pp feed.items[1].updated
37
+ assert_equal '2014-11-26T12:11:25+00:00', feed.items[1].updated.to_s
38
+ end
39
+
40
+ end # class TestAtomV03
41
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feedutils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-20 00:00:00.000000000 Z
11
+ date: 2015-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logutils
@@ -70,14 +70,17 @@ files:
70
70
  - lib/feedutils/builder/atom.rb
71
71
  - lib/feedutils/builder/rss.rb
72
72
  - lib/feedutils/feed.rb
73
+ - lib/feedutils/helper/atom_v03.rb
73
74
  - lib/feedutils/item.rb
74
75
  - lib/feedutils/parser.rb
75
76
  - lib/feedutils/version.rb
76
77
  - test/feeds/googlegroups.atom
77
78
  - test/feeds/googlegroups2.atom
79
+ - test/feeds/quirksblog.atom.v03
78
80
  - test/helper.rb
79
81
  - test/test_atom.rb
80
82
  - test/test_atom_from_file.rb
83
+ - test/test_atom_v03.rb
81
84
  - test/test_rss.rb
82
85
  homepage: https://github.com/rubylibs/feedutils
83
86
  licenses:
@@ -106,6 +109,7 @@ signing_key:
106
109
  specification_version: 4
107
110
  summary: feedutils - web feed parser and normalizer (RSS 2.0, Atom, etc.)
108
111
  test_files:
112
+ - test/test_atom_v03.rb
109
113
  - test/test_atom.rb
110
114
  - test/test_atom_from_file.rb
111
115
  - test/test_rss.rb