feedjira 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +8 -0
- data/.travis.yml +31 -12
- data/CHANGELOG.md +15 -1
- data/Dangerfile +1 -0
- data/Gemfile +2 -1
- data/Rakefile +6 -1
- data/feedjira.gemspec +16 -14
- data/fixtures/vcr_cassettes/fetch_failure.yml +62 -0
- data/fixtures/vcr_cassettes/parse_error.yml +222 -0
- data/fixtures/vcr_cassettes/success.yml +281 -0
- data/lib/feedjira.rb +9 -0
- data/lib/feedjira/core_ext.rb +3 -3
- data/lib/feedjira/core_ext/date.rb +2 -1
- data/lib/feedjira/core_ext/string.rb +1 -1
- data/lib/feedjira/core_ext/time.rb +19 -16
- data/lib/feedjira/date_time_utilities.rb +24 -0
- data/lib/feedjira/date_time_utilities/date_time_language_parser.rb +22 -0
- data/lib/feedjira/date_time_utilities/date_time_pattern_parser.rb +29 -0
- data/lib/feedjira/feed.rb +27 -18
- data/lib/feedjira/feed_entry_utilities.rb +15 -17
- data/lib/feedjira/feed_utilities.rb +26 -21
- data/lib/feedjira/parser/atom.rb +9 -8
- data/lib/feedjira/parser/atom_entry.rb +10 -13
- data/lib/feedjira/parser/atom_feed_burner.rb +8 -10
- data/lib/feedjira/parser/atom_feed_burner_entry.rb +11 -14
- data/lib/feedjira/parser/atom_youtube.rb +20 -0
- data/lib/feedjira/parser/atom_youtube_entry.rb +29 -0
- data/lib/feedjira/parser/google_docs_atom.rb +6 -6
- data/lib/feedjira/parser/google_docs_atom_entry.rb +11 -11
- data/lib/feedjira/parser/itunes_rss.rb +39 -22
- data/lib/feedjira/parser/itunes_rss_category.rb +38 -0
- data/lib/feedjira/parser/itunes_rss_item.rb +28 -20
- data/lib/feedjira/parser/itunes_rss_owner.rb +3 -4
- data/lib/feedjira/parser/podlove_chapter.rb +20 -0
- data/lib/feedjira/parser/rss.rb +10 -8
- data/lib/feedjira/parser/rss_entry.rb +17 -21
- data/lib/feedjira/parser/rss_feed_burner.rb +4 -6
- data/lib/feedjira/parser/rss_feed_burner_entry.rb +23 -28
- data/lib/feedjira/parser/rss_image.rb +15 -0
- data/lib/feedjira/preprocessor.rb +2 -2
- data/lib/feedjira/version.rb +1 -1
- data/spec/feedjira/date_time_utilities_spec.rb +41 -0
- data/spec/feedjira/feed_entry_utilities_spec.rb +23 -19
- data/spec/feedjira/feed_spec.rb +109 -74
- data/spec/feedjira/feed_utilities_spec.rb +65 -63
- data/spec/feedjira/parser/atom_entry_spec.rb +54 -34
- data/spec/feedjira/parser/atom_feed_burner_entry_spec.rb +27 -20
- data/spec/feedjira/parser/atom_feed_burner_spec.rb +32 -30
- data/spec/feedjira/parser/atom_spec.rb +50 -48
- data/spec/feedjira/parser/atom_youtube_entry_spec.rb +86 -0
- data/spec/feedjira/parser/atom_youtube_spec.rb +43 -0
- data/spec/feedjira/parser/google_docs_atom_entry_spec.rb +5 -4
- data/spec/feedjira/parser/google_docs_atom_spec.rb +6 -6
- data/spec/feedjira/parser/itunes_rss_item_spec.rb +33 -29
- data/spec/feedjira/parser/itunes_rss_owner_spec.rb +10 -9
- data/spec/feedjira/parser/itunes_rss_spec.rb +83 -30
- data/spec/feedjira/parser/podlove_chapter_spec.rb +37 -0
- data/spec/feedjira/parser/rss_entry_spec.rb +50 -33
- data/spec/feedjira/parser/rss_feed_burner_entry_spec.rb +55 -33
- data/spec/feedjira/parser/rss_feed_burner_spec.rb +31 -26
- data/spec/feedjira/parser/rss_spec.rb +56 -24
- data/spec/feedjira/preprocessor_spec.rb +11 -3
- data/spec/sample_feeds.rb +29 -21
- data/spec/sample_feeds/AmazonWebServicesBlog.xml +797 -797
- data/spec/sample_feeds/AtomEscapedHTMLInPreTag.xml +13 -0
- data/spec/sample_feeds/CRE.xml +5849 -0
- data/spec/sample_feeds/FeedBurnerXHTML.xml +400 -400
- data/spec/sample_feeds/ITunesWithSingleQuotedAttributes.xml +67 -0
- data/spec/sample_feeds/PaulDixExplainsNothing.xml +175 -175
- data/spec/sample_feeds/PaulDixExplainsNothingAlternate.xml +175 -175
- data/spec/sample_feeds/PaulDixExplainsNothingFirstEntryContent.xml +16 -16
- data/spec/sample_feeds/PaulDixExplainsNothingWFW.xml +174 -174
- data/spec/sample_feeds/TenderLovemaking.xml +12 -2
- data/spec/sample_feeds/TrotterCashionHome.xml +611 -611
- data/spec/sample_feeds/TypePadNews.xml +368 -368
- data/spec/sample_feeds/itunes.xml +18 -2
- data/spec/sample_feeds/pet_atom.xml +229 -229
- data/spec/sample_feeds/youtube_atom.xml +395 -0
- data/spec/spec_helper.rb +6 -0
- metadata +112 -27
@@ -1,58 +1,64 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Feedjira::Parser::AtomEntry do
|
4
4
|
before(:each) do
|
5
|
-
# I don't really like doing it this way because these unit test should only
|
6
|
-
# but this is actually how it should work. You would
|
5
|
+
# I don't really like doing it this way because these unit test should only
|
6
|
+
# rely on AtomEntry, but this is actually how it should work. You would
|
7
|
+
# never just pass entry xml straight to the AtomEnry
|
7
8
|
@entry = Feedjira::Parser::Atom.parse(sample_atom_feed).entries.first
|
8
9
|
end
|
9
10
|
|
10
|
-
it
|
11
|
-
|
11
|
+
it 'should parse the title' do
|
12
|
+
title = 'AWS Job: Architect & Designer Position in Turkey'
|
13
|
+
expect(@entry.title).to eq title
|
12
14
|
end
|
13
15
|
|
14
|
-
it
|
15
|
-
expect(@entry.url).to eq
|
16
|
+
it 'should parse the url' do
|
17
|
+
expect(@entry.url).to eq 'http://aws.typepad.com/aws/2009/01/aws-job-architect-designer-position-in-turkey.html'
|
16
18
|
end
|
17
19
|
|
18
|
-
it
|
19
|
-
|
20
|
-
|
20
|
+
it 'should parse the url even when' do
|
21
|
+
xml = load_sample('atom_with_link_tag_for_url_unmarked.xml')
|
22
|
+
entries = Feedjira::Parser::Atom.parse(xml).entries
|
23
|
+
expect(entries.first.url).to eq 'http://www.innoq.com/blog/phaus/2009/07/ja.html'
|
21
24
|
end
|
22
25
|
|
23
|
-
it
|
24
|
-
expect(@entry.author).to eq
|
26
|
+
it 'should parse the author' do
|
27
|
+
expect(@entry.author).to eq 'AWS Editor'
|
25
28
|
end
|
26
29
|
|
27
|
-
it
|
30
|
+
it 'should parse the content' do
|
28
31
|
expect(@entry.content).to eq sample_atom_entry_content
|
29
32
|
end
|
30
33
|
|
31
|
-
it
|
32
|
-
|
34
|
+
it 'should provide a summary' do
|
35
|
+
summary = "Late last year an entrepreneur from Turkey visited me at Amazon HQ in Seattle. We talked about his plans to use AWS as part of his new social video portal startup. I won't spill any beans before he's ready to..." # rubocop:disable Metrics/LineLength
|
36
|
+
expect(@entry.summary).to eq summary
|
33
37
|
end
|
34
38
|
|
35
|
-
it
|
36
|
-
|
39
|
+
it 'should parse the published date' do
|
40
|
+
published = Time.parse_safely 'Fri Jan 16 18:21:00 UTC 2009'
|
41
|
+
expect(@entry.published).to eq published
|
37
42
|
end
|
38
43
|
|
39
|
-
it
|
40
|
-
expect(@entry.categories).to eq
|
44
|
+
it 'should parse the categories' do
|
45
|
+
expect(@entry.categories).to eq %w(Turkey Seattle)
|
41
46
|
end
|
42
47
|
|
43
|
-
it
|
44
|
-
|
48
|
+
it 'should parse the updated date' do
|
49
|
+
updated = Time.parse_safely 'Fri Jan 16 18:21:00 UTC 2009'
|
50
|
+
expect(@entry.updated).to eq updated
|
45
51
|
end
|
46
52
|
|
47
|
-
it
|
48
|
-
expect(@entry.id).to eq
|
53
|
+
it 'should parse the id' do
|
54
|
+
expect(@entry.id).to eq 'tag:typepad.com,2003:post-61484736'
|
49
55
|
end
|
50
56
|
|
51
|
-
it
|
57
|
+
it 'should support each' do
|
52
58
|
expect(@entry).to respond_to :each
|
53
59
|
end
|
54
60
|
|
55
|
-
it
|
61
|
+
it 'should be able to list out all fields with each' do
|
56
62
|
all_fields = []
|
57
63
|
title_value = ''
|
58
64
|
|
@@ -61,22 +67,36 @@ describe Feedjira::Parser::AtomEntry do
|
|
61
67
|
title_value = value if field == 'title'
|
62
68
|
end
|
63
69
|
|
64
|
-
expect(
|
65
|
-
|
70
|
+
expect(title_value).to eq 'AWS Job: Architect & Designer Position in Turkey'
|
71
|
+
|
72
|
+
expected_fields = %w(
|
73
|
+
author
|
74
|
+
categories
|
75
|
+
content
|
76
|
+
entry_id
|
77
|
+
links
|
78
|
+
published
|
79
|
+
summary
|
80
|
+
title
|
81
|
+
updated
|
82
|
+
url
|
83
|
+
)
|
84
|
+
expect(all_fields.sort).to eq expected_fields
|
66
85
|
end
|
67
86
|
|
68
|
-
it
|
87
|
+
it 'should support checking if a field exists in the entry' do
|
69
88
|
expect(@entry).to include 'author'
|
70
89
|
expect(@entry).to include 'title'
|
71
90
|
end
|
72
91
|
|
73
|
-
it
|
74
|
-
|
75
|
-
expect(@entry['
|
92
|
+
it 'should allow access to fields with hash syntax' do
|
93
|
+
title = 'AWS Job: Architect & Designer Position in Turkey'
|
94
|
+
expect(@entry['title']).to eq title
|
95
|
+
expect(@entry['author']).to eq 'AWS Editor'
|
76
96
|
end
|
77
97
|
|
78
|
-
it
|
79
|
-
@entry['title'] =
|
80
|
-
expect(@entry.title).to eq
|
98
|
+
it 'should allow setting field values with hash syntax' do
|
99
|
+
@entry['title'] = 'Foobar'
|
100
|
+
expect(@entry.title).to eq 'Foobar'
|
81
101
|
end
|
82
102
|
end
|
@@ -1,47 +1,54 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Feedjira::Parser::AtomFeedBurnerEntry do
|
4
4
|
before(:each) do
|
5
|
-
|
6
|
-
#
|
7
|
-
|
5
|
+
Feedjira::Parser::AtomFeedBurner.preprocess_xml = false
|
6
|
+
# I don't really like doing it this way because these unit test should only
|
7
|
+
# rely on AtomEntry, but this is actually how it should work. You would
|
8
|
+
# never just pass entry xml straight to the AtomEnry
|
9
|
+
feed = Feedjira::Parser::AtomFeedBurner.parse sample_feedburner_atom_feed
|
10
|
+
@entry = feed.entries.first
|
8
11
|
end
|
9
12
|
|
10
|
-
it
|
11
|
-
expect(@entry.title).to eq
|
13
|
+
it 'should parse the title' do
|
14
|
+
expect(@entry.title).to eq 'Making a Ruby C library even faster'
|
12
15
|
end
|
13
16
|
|
14
|
-
it "should be able to fetch a url via the 'alternate' rel if no origLink exists" do
|
15
|
-
|
17
|
+
it "should be able to fetch a url via the 'alternate' rel if no origLink exists" do # rubocop:disable Metrics/LineLength
|
18
|
+
xml = File.read("#{File.dirname(__FILE__)}/../../sample_feeds/PaulDixExplainsNothingAlternate.xml") # rubocop:disable Metrics/LineLength
|
19
|
+
entry = Feedjira::Parser::AtomFeedBurner.parse(xml).entries.first
|
16
20
|
expect(entry.url).to eq 'http://feeds.feedburner.com/~r/PaulDixExplainsNothing/~3/519925023/making-a-ruby-c-library-even-faster.html'
|
17
21
|
end
|
18
22
|
|
19
|
-
it
|
20
|
-
expect(@entry.url).to eq
|
23
|
+
it 'should parse the url' do
|
24
|
+
expect(@entry.url).to eq 'http://www.pauldix.net/2009/01/making-a-ruby-c-library-even-faster.html'
|
21
25
|
end
|
22
26
|
|
23
|
-
it
|
24
|
-
|
27
|
+
it 'should parse the url when there is no alternate' do
|
28
|
+
xml = File.read("#{File.dirname(__FILE__)}/../../sample_feeds/FeedBurnerUrlNoAlternate.xml") # rubocop:disable Metrics/LineLength
|
29
|
+
entry = Feedjira::Parser::AtomFeedBurner.parse(xml).entries.first
|
25
30
|
expect(entry.url).to eq 'http://example.com/QQQQ.html'
|
26
31
|
end
|
27
32
|
|
28
|
-
it
|
29
|
-
expect(@entry.author).to eq
|
33
|
+
it 'should parse the author' do
|
34
|
+
expect(@entry.author).to eq 'Paul Dix'
|
30
35
|
end
|
31
36
|
|
32
|
-
it
|
37
|
+
it 'should parse the content' do
|
33
38
|
expect(@entry.content).to eq sample_feedburner_atom_entry_content
|
34
39
|
end
|
35
40
|
|
36
|
-
it
|
37
|
-
|
41
|
+
it 'should provide a summary' do
|
42
|
+
summary = "Last week I released the first version of a SAX based XML parsing library called SAX-Machine. It uses Nokogiri, which uses libxml, so it's pretty fast. However, I felt that it could be even faster. The only question was how..." # rubocop:disable Metrics/LineLength
|
43
|
+
expect(@entry.summary).to eq summary
|
38
44
|
end
|
39
45
|
|
40
|
-
it
|
41
|
-
|
46
|
+
it 'should parse the published date' do
|
47
|
+
published = Time.parse_safely 'Thu Jan 22 15:50:22 UTC 2009'
|
48
|
+
expect(@entry.published).to eq published
|
42
49
|
end
|
43
50
|
|
44
|
-
it
|
51
|
+
it 'should parse the categories' do
|
45
52
|
expect(@entry.categories).to eq ['Ruby', 'Another Category']
|
46
53
|
end
|
47
54
|
end
|
@@ -1,67 +1,69 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
describe
|
5
|
-
it
|
6
|
-
expect(
|
3
|
+
module Feedjira::Parser
|
4
|
+
describe '#will_parse?' do
|
5
|
+
it 'should return true for a feedburner atom feed' do
|
6
|
+
expect(AtomFeedBurner).to be_able_to_parse(sample_feedburner_atom_feed)
|
7
7
|
end
|
8
8
|
|
9
|
-
it
|
10
|
-
expect(
|
9
|
+
it 'should return false for an rdf feed' do
|
10
|
+
expect(AtomFeedBurner).to_not be_able_to_parse(sample_rdf_feed)
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
14
|
-
expect(
|
13
|
+
it 'should return false for a regular atom feed' do
|
14
|
+
expect(AtomFeedBurner).to_not be_able_to_parse(sample_atom_feed)
|
15
15
|
end
|
16
16
|
|
17
|
-
it
|
18
|
-
expect(
|
17
|
+
it 'should return false for an rss feedburner feed' do
|
18
|
+
expect(AtomFeedBurner).to_not be_able_to_parse sample_rss_feed_burner_feed
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
describe
|
22
|
+
describe 'parsing' do
|
23
23
|
before(:each) do
|
24
|
-
@feed =
|
24
|
+
@feed = AtomFeedBurner.parse(sample_feedburner_atom_feed)
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
28
|
-
expect(@feed.title).to eq
|
27
|
+
it 'should parse the title' do
|
28
|
+
expect(@feed.title).to eq 'Paul Dix Explains Nothing'
|
29
29
|
end
|
30
30
|
|
31
|
-
it
|
32
|
-
|
31
|
+
it 'should parse the description' do
|
32
|
+
description = 'Entrepreneurship, programming, software development, politics, NYC, and random thoughts.' # rubocop:disable Metrics/LineLength
|
33
|
+
expect(@feed.description).to eq description
|
33
34
|
end
|
34
35
|
|
35
|
-
it
|
36
|
-
expect(@feed.url).to eq
|
36
|
+
it 'should parse the url' do
|
37
|
+
expect(@feed.url).to eq 'http://www.pauldix.net/'
|
37
38
|
end
|
38
39
|
|
39
|
-
it
|
40
|
-
expect(@feed.feed_url).to eq
|
40
|
+
it 'should parse the feed_url' do
|
41
|
+
expect(@feed.feed_url).to eq 'http://feeds.feedburner.com/PaulDixExplainsNothing'
|
41
42
|
end
|
42
43
|
|
43
|
-
it
|
44
|
+
it 'should parse no hub urls' do
|
44
45
|
expect(@feed.hubs.count).to eq 0
|
45
46
|
end
|
46
47
|
|
47
|
-
it
|
48
|
-
|
48
|
+
it 'should parse hub urls' do
|
49
|
+
AtomFeedBurner.preprocess_xml = false
|
50
|
+
feed_with_hub = AtomFeedBurner.parse(load_sample('TypePadNews.xml'))
|
49
51
|
expect(feed_with_hub.hubs.count).to eq 1
|
50
52
|
end
|
51
53
|
|
52
|
-
it
|
54
|
+
it 'should parse entries' do
|
53
55
|
expect(@feed.entries.size).to eq 5
|
54
56
|
end
|
55
57
|
end
|
56
58
|
|
57
|
-
describe
|
58
|
-
it
|
59
|
-
|
59
|
+
describe 'preprocessing' do
|
60
|
+
it 'retains markup in xhtml content' do
|
61
|
+
AtomFeedBurner.preprocess_xml = true
|
60
62
|
|
61
|
-
feed =
|
63
|
+
feed = AtomFeedBurner.parse sample_feed_burner_atom_xhtml_feed
|
62
64
|
entry = feed.entries.first
|
63
65
|
|
64
|
-
expect(entry.content).to match
|
66
|
+
expect(entry.content).to match(/\A\<p/)
|
65
67
|
end
|
66
68
|
end
|
67
69
|
end
|
@@ -1,102 +1,104 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
describe
|
5
|
-
it
|
6
|
-
expect(
|
3
|
+
module Feedjira::Parser
|
4
|
+
describe '#will_parse?' do
|
5
|
+
it 'should return true for an atom feed' do
|
6
|
+
expect(Atom).to be_able_to_parse(sample_atom_feed)
|
7
7
|
end
|
8
8
|
|
9
|
-
it
|
10
|
-
expect(
|
9
|
+
it 'should return false for an rdf feed' do
|
10
|
+
expect(Atom).to_not be_able_to_parse(sample_rdf_feed)
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
14
|
-
expect(
|
13
|
+
it 'should return false for an rss feedburner feed' do
|
14
|
+
expect(Atom).to_not be_able_to_parse(sample_rss_feed_burner_feed)
|
15
15
|
end
|
16
16
|
|
17
|
-
it
|
18
|
-
expect(
|
17
|
+
it 'should return true for an atom feed that has line breaks in between attributes in the <feed> node' do # rubocop:disable Metrics/LineLength
|
18
|
+
expect(Atom).to be_able_to_parse(sample_atom_feed_line_breaks)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
describe
|
22
|
+
describe 'parsing' do
|
23
23
|
before(:each) do
|
24
|
-
@feed =
|
24
|
+
@feed = Atom.parse(sample_atom_feed)
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
28
|
-
expect(@feed.title).to eq
|
27
|
+
it 'should parse the title' do
|
28
|
+
expect(@feed.title).to eq 'Amazon Web Services Blog'
|
29
29
|
end
|
30
30
|
|
31
|
-
it
|
32
|
-
|
31
|
+
it 'should parse the description' do
|
32
|
+
description = 'Amazon Web Services, Products, Tools, and Developer Information...' # rubocop:disable Metrics/LineLength
|
33
|
+
expect(@feed.description).to eq description
|
33
34
|
end
|
34
35
|
|
35
|
-
it
|
36
|
-
expect(@feed.url).to eq
|
36
|
+
it 'should parse the url' do
|
37
|
+
expect(@feed.url).to eq 'http://aws.typepad.com/aws/'
|
37
38
|
end
|
38
39
|
|
39
|
-
it "should parse the url even when it doesn't have the type='text/html' attribute" do
|
40
|
-
|
41
|
-
|
40
|
+
it "should parse the url even when it doesn't have the type='text/html' attribute" do # rubocop:disable Metrics/LineLength
|
41
|
+
xml = load_sample 'atom_with_link_tag_for_url_unmarked.xml'
|
42
|
+
feed = Atom.parse xml
|
43
|
+
expect(feed.url).to eq 'http://www.innoq.com/planet/'
|
42
44
|
end
|
43
45
|
|
44
|
-
it "should parse the feed_url even when it doesn't have the type='application/atom+xml' attribute" do
|
45
|
-
feed =
|
46
|
-
expect(feed.feed_url).to eq
|
46
|
+
it "should parse the feed_url even when it doesn't have the type='application/atom+xml' attribute" do # rubocop:disable Metrics/LineLength
|
47
|
+
feed = Atom.parse(load_sample('atom_with_link_tag_for_url_unmarked.xml'))
|
48
|
+
expect(feed.feed_url).to eq 'http://www.innoq.com/planet/atom.xml'
|
47
49
|
end
|
48
50
|
|
49
|
-
it
|
50
|
-
expect(@feed.feed_url).to eq
|
51
|
+
it 'should parse the feed_url' do
|
52
|
+
expect(@feed.feed_url).to eq 'http://aws.typepad.com/aws/atom.xml'
|
51
53
|
end
|
52
54
|
|
53
|
-
it
|
55
|
+
it 'should parse no hub urls' do
|
54
56
|
expect(@feed.hubs.count).to eq 0
|
55
57
|
end
|
56
58
|
|
57
|
-
it
|
58
|
-
feed_with_hub =
|
59
|
+
it 'should parse the hub urls' do
|
60
|
+
feed_with_hub = Atom.parse(load_sample('SamRuby.xml'))
|
59
61
|
expect(feed_with_hub.hubs.count).to eq 1
|
60
|
-
expect(feed_with_hub.hubs.first).to eq
|
62
|
+
expect(feed_with_hub.hubs.first).to eq 'http://pubsubhubbub.appspot.com/'
|
61
63
|
end
|
62
64
|
|
63
|
-
it
|
65
|
+
it 'should parse entries' do
|
64
66
|
expect(@feed.entries.size).to eq 10
|
65
67
|
end
|
66
68
|
end
|
67
69
|
|
68
|
-
describe
|
69
|
-
it
|
70
|
-
|
70
|
+
describe 'preprocessing' do
|
71
|
+
it 'retains markup in xhtml content' do
|
72
|
+
Atom.preprocess_xml = true
|
71
73
|
|
72
|
-
feed =
|
74
|
+
feed = Atom.parse sample_atom_xhtml_feed
|
73
75
|
entry = feed.entries.first
|
74
76
|
|
75
|
-
expect(entry.title).to match
|
76
|
-
expect(entry.summary).to match
|
77
|
-
expect(entry.content).to match
|
77
|
+
expect(entry.title).to match(/\<i/)
|
78
|
+
expect(entry.summary).to match(/\<b/)
|
79
|
+
expect(entry.content).to match(/\A\<p/)
|
78
80
|
end
|
79
81
|
|
80
|
-
it
|
81
|
-
|
82
|
+
it 'should not duplicate content when there are divs in content' do
|
83
|
+
Atom.preprocess_xml = true
|
82
84
|
|
83
|
-
feed =
|
85
|
+
feed = Atom.parse sample_duplicate_content_atom_feed
|
84
86
|
content = Nokogiri::HTML(feed.entries[1].content)
|
85
87
|
expect(content.css('img').length).to eq 11
|
86
88
|
end
|
87
89
|
end
|
88
90
|
|
89
|
-
describe
|
91
|
+
describe 'parsing url and feed url based on rel attribute' do
|
90
92
|
before :each do
|
91
|
-
@feed =
|
93
|
+
@feed = Atom.parse(sample_atom_middleman_feed)
|
92
94
|
end
|
93
95
|
|
94
|
-
it
|
95
|
-
expect(@feed.url).to eq
|
96
|
+
it 'should parse url' do
|
97
|
+
expect(@feed.url).to eq 'http://feedjira.com/blog'
|
96
98
|
end
|
97
99
|
|
98
|
-
it
|
99
|
-
expect(@feed.feed_url).to eq
|
100
|
+
it 'should parse feed url' do
|
101
|
+
expect(@feed.feed_url).to eq 'http://feedjira.com/blog/feed.xml'
|
100
102
|
end
|
101
103
|
end
|
102
104
|
end
|