feedjira 2.0.0 → 2.1.0

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 (82) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +8 -0
  4. data/.travis.yml +31 -12
  5. data/CHANGELOG.md +15 -1
  6. data/Dangerfile +1 -0
  7. data/Gemfile +2 -1
  8. data/Rakefile +6 -1
  9. data/feedjira.gemspec +16 -14
  10. data/fixtures/vcr_cassettes/fetch_failure.yml +62 -0
  11. data/fixtures/vcr_cassettes/parse_error.yml +222 -0
  12. data/fixtures/vcr_cassettes/success.yml +281 -0
  13. data/lib/feedjira.rb +9 -0
  14. data/lib/feedjira/core_ext.rb +3 -3
  15. data/lib/feedjira/core_ext/date.rb +2 -1
  16. data/lib/feedjira/core_ext/string.rb +1 -1
  17. data/lib/feedjira/core_ext/time.rb +19 -16
  18. data/lib/feedjira/date_time_utilities.rb +24 -0
  19. data/lib/feedjira/date_time_utilities/date_time_language_parser.rb +22 -0
  20. data/lib/feedjira/date_time_utilities/date_time_pattern_parser.rb +29 -0
  21. data/lib/feedjira/feed.rb +27 -18
  22. data/lib/feedjira/feed_entry_utilities.rb +15 -17
  23. data/lib/feedjira/feed_utilities.rb +26 -21
  24. data/lib/feedjira/parser/atom.rb +9 -8
  25. data/lib/feedjira/parser/atom_entry.rb +10 -13
  26. data/lib/feedjira/parser/atom_feed_burner.rb +8 -10
  27. data/lib/feedjira/parser/atom_feed_burner_entry.rb +11 -14
  28. data/lib/feedjira/parser/atom_youtube.rb +20 -0
  29. data/lib/feedjira/parser/atom_youtube_entry.rb +29 -0
  30. data/lib/feedjira/parser/google_docs_atom.rb +6 -6
  31. data/lib/feedjira/parser/google_docs_atom_entry.rb +11 -11
  32. data/lib/feedjira/parser/itunes_rss.rb +39 -22
  33. data/lib/feedjira/parser/itunes_rss_category.rb +38 -0
  34. data/lib/feedjira/parser/itunes_rss_item.rb +28 -20
  35. data/lib/feedjira/parser/itunes_rss_owner.rb +3 -4
  36. data/lib/feedjira/parser/podlove_chapter.rb +20 -0
  37. data/lib/feedjira/parser/rss.rb +10 -8
  38. data/lib/feedjira/parser/rss_entry.rb +17 -21
  39. data/lib/feedjira/parser/rss_feed_burner.rb +4 -6
  40. data/lib/feedjira/parser/rss_feed_burner_entry.rb +23 -28
  41. data/lib/feedjira/parser/rss_image.rb +15 -0
  42. data/lib/feedjira/preprocessor.rb +2 -2
  43. data/lib/feedjira/version.rb +1 -1
  44. data/spec/feedjira/date_time_utilities_spec.rb +41 -0
  45. data/spec/feedjira/feed_entry_utilities_spec.rb +23 -19
  46. data/spec/feedjira/feed_spec.rb +109 -74
  47. data/spec/feedjira/feed_utilities_spec.rb +65 -63
  48. data/spec/feedjira/parser/atom_entry_spec.rb +54 -34
  49. data/spec/feedjira/parser/atom_feed_burner_entry_spec.rb +27 -20
  50. data/spec/feedjira/parser/atom_feed_burner_spec.rb +32 -30
  51. data/spec/feedjira/parser/atom_spec.rb +50 -48
  52. data/spec/feedjira/parser/atom_youtube_entry_spec.rb +86 -0
  53. data/spec/feedjira/parser/atom_youtube_spec.rb +43 -0
  54. data/spec/feedjira/parser/google_docs_atom_entry_spec.rb +5 -4
  55. data/spec/feedjira/parser/google_docs_atom_spec.rb +6 -6
  56. data/spec/feedjira/parser/itunes_rss_item_spec.rb +33 -29
  57. data/spec/feedjira/parser/itunes_rss_owner_spec.rb +10 -9
  58. data/spec/feedjira/parser/itunes_rss_spec.rb +83 -30
  59. data/spec/feedjira/parser/podlove_chapter_spec.rb +37 -0
  60. data/spec/feedjira/parser/rss_entry_spec.rb +50 -33
  61. data/spec/feedjira/parser/rss_feed_burner_entry_spec.rb +55 -33
  62. data/spec/feedjira/parser/rss_feed_burner_spec.rb +31 -26
  63. data/spec/feedjira/parser/rss_spec.rb +56 -24
  64. data/spec/feedjira/preprocessor_spec.rb +11 -3
  65. data/spec/sample_feeds.rb +29 -21
  66. data/spec/sample_feeds/AmazonWebServicesBlog.xml +797 -797
  67. data/spec/sample_feeds/AtomEscapedHTMLInPreTag.xml +13 -0
  68. data/spec/sample_feeds/CRE.xml +5849 -0
  69. data/spec/sample_feeds/FeedBurnerXHTML.xml +400 -400
  70. data/spec/sample_feeds/ITunesWithSingleQuotedAttributes.xml +67 -0
  71. data/spec/sample_feeds/PaulDixExplainsNothing.xml +175 -175
  72. data/spec/sample_feeds/PaulDixExplainsNothingAlternate.xml +175 -175
  73. data/spec/sample_feeds/PaulDixExplainsNothingFirstEntryContent.xml +16 -16
  74. data/spec/sample_feeds/PaulDixExplainsNothingWFW.xml +174 -174
  75. data/spec/sample_feeds/TenderLovemaking.xml +12 -2
  76. data/spec/sample_feeds/TrotterCashionHome.xml +611 -611
  77. data/spec/sample_feeds/TypePadNews.xml +368 -368
  78. data/spec/sample_feeds/itunes.xml +18 -2
  79. data/spec/sample_feeds/pet_atom.xml +229 -229
  80. data/spec/sample_feeds/youtube_atom.xml +395 -0
  81. data/spec/spec_helper.rb +6 -0
  82. metadata +112 -27
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe Feedjira::Parser::PodloveChapter do
4
+ before(:each) do
5
+ @item = Feedjira::Parser::ITunesRSS.parse(sample_podlove_feed).entries.first
6
+ @chapter = @item.chapters.first
7
+ end
8
+
9
+ it 'should parse chapters' do
10
+ expect(@item.chapters.size).to eq 15
11
+ end
12
+
13
+ it 'should sort chapters by time' do
14
+ expect(@item.chapters.last.title).to eq 'Abschied'
15
+ end
16
+
17
+ it 'should parse the start time' do
18
+ expect(@chapter.start_ntp).to eq '00:00:26.407'
19
+ expect(@chapter.start).to eq 26.407
20
+ expect(@item.chapters[1].start).to eq 50
21
+ expect(@item.chapters[2].start).to eq 59.12
22
+ expect(@item.chapters[3].start).to eq 89.201
23
+ expect(@item.chapters.last.start).to eq 5700.034
24
+ end
25
+
26
+ it 'should parse the title' do
27
+ expect(@chapter.title).to eq 'Neil DeGrasse Tyson on Science'
28
+ end
29
+
30
+ it 'should parse the link' do
31
+ expect(@chapter.url).to eq 'https://example.com'
32
+ end
33
+
34
+ it 'should parse the image' do
35
+ expect(@chapter.image).to eq 'https://pics.example.com/pic.png'
36
+ end
37
+ end
@@ -1,80 +1,97 @@
1
- # coding: utf-8
2
- require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
1
+ require 'spec_helper'
3
2
 
4
3
  describe Feedjira::Parser::RSSEntry do
5
4
  before(:each) do
6
- # I don't really like doing it this way because these unit test should only rely on RSSEntry,
7
- # but this is actually how it should work. You would never just pass entry xml straight to the AtomEnry
5
+ # I don't really like doing it this way because these unit test should only
6
+ # rely on RSSEntry, but this is actually how it should work. You would
7
+ # never just pass entry xml straight to the AtomEnry
8
8
  @entry = Feedjira::Parser::RSS.parse(sample_rss_feed).entries.first
9
- Feedjira::Feed.add_common_feed_entry_element("wfw:commentRss", :as => :comment_rss)
9
+ tag = 'wfw:commentRss'
10
+ Feedjira::Feed.add_common_feed_entry_element tag, as: :comment_rss
10
11
  end
11
12
 
12
13
  after(:each) do
13
14
  # We change the title in one or more specs to test []=
14
- if @entry.title != "Nokogiri’s Slop Feature"
15
- @entry.title = Feedjira::Parser::RSS.parse(sample_rss_feed).entries.first.title
15
+ if @entry.title != 'Nokogiri’s Slop Feature'
16
+ feed = Feedjira::Parser::RSS.parse sample_rss_feed
17
+ @entry.title = feed.entries.first.title
16
18
  end
17
19
  end
18
20
 
19
- it "should parse the title" do
20
- expect(@entry.title).to eq "Nokogiri’s Slop Feature"
21
+ it 'should parse the title' do
22
+ expect(@entry.title).to eq 'Nokogiri’s Slop Feature'
21
23
  end
22
24
 
23
- it "should parse the url" do
24
- expect(@entry.url).to eq "http://tenderlovemaking.com/2008/12/04/nokogiris-slop-feature/"
25
+ it 'should parse the url' do
26
+ expect(@entry.url).to eq 'http://tenderlovemaking.com/2008/12/04/nokogiris-slop-feature/'
25
27
  end
26
28
 
27
- it "should parse the author" do
28
- expect(@entry.author).to eq "Aaron Patterson"
29
+ it 'should parse the author' do
30
+ expect(@entry.author).to eq 'Aaron Patterson'
29
31
  end
30
32
 
31
- it "should parse the content" do
33
+ it 'should parse the content' do
32
34
  expect(@entry.content).to eq sample_rss_entry_content
33
35
  end
34
36
 
35
- it "should provide a summary" do
36
- expect(@entry.summary).to eq "Oops! When I released nokogiri version 1.0.7, I totally forgot to talk about Nokogiri::Slop() feature that was added. Why is it called \"slop\"? It lets you sloppily explore documents. Basically, it decorates your document with method_missing() that allows you to search your document via method calls.\nGiven this document:\n\ndoc = Nokogiri::Slop(<<-eohtml)\n<html>\n  <body>\n  [...]"
37
+ it 'should provide a summary' do
38
+ summary = "Oops! When I released nokogiri version 1.0.7, I totally forgot to talk about Nokogiri::Slop() feature that was added. Why is it called \"slop\"? It lets you sloppily explore documents. Basically, it decorates your document with method_missing() that allows you to search your document via method calls.\nGiven this document:\n\ndoc = Nokogiri::Slop(<<-eohtml)\n<html>\n  <body>\n  [...]" # rubocop:disable Metrics/LineLength
39
+ expect(@entry.summary).to eq summary
37
40
  end
38
41
 
39
- it "should parse the published date" do
40
- expect(@entry.published).to eq Time.parse_safely("Thu Dec 04 17:17:49 UTC 2008")
42
+ it 'should parse the published date' do
43
+ published = Time.parse_safely 'Thu Dec 04 17:17:49 UTC 2008'
44
+ expect(@entry.published).to eq published
41
45
  end
42
46
 
43
- it "should parse the categories" do
44
- expect(@entry.categories).to eq ['computadora', 'nokogiri', 'rails']
47
+ it 'should parse the categories' do
48
+ expect(@entry.categories).to eq %w(computadora nokogiri rails)
45
49
  end
46
50
 
47
- it "should parse the guid as id" do
48
- expect(@entry.id).to eq "http://tenderlovemaking.com/?p=198"
51
+ it 'should parse the guid as id' do
52
+ expect(@entry.id).to eq 'http://tenderlovemaking.com/?p=198'
49
53
  end
50
54
 
51
- it "should support each" do
55
+ it 'should support each' do
52
56
  expect(@entry).to respond_to :each
53
57
  end
54
58
 
55
- it "should be able to list out all fields with each" do
59
+ it 'should be able to list out all fields with each' do
56
60
  all_fields = []
57
61
  title_value = ''
58
62
  @entry.each do |field, value|
59
63
  all_fields << field
60
64
  title_value = value if field == 'title'
61
65
  end
62
- expect(all_fields.sort).to eq ["author", "categories", "comment_rss", "content", "entry_id", "published", "summary", "title", "url"]
63
- expect(title_value).to eq "Nokogiri’s Slop Feature"
66
+
67
+ expect(title_value).to eq 'Nokogiri’s Slop Feature'
68
+
69
+ expected_fields = %w(
70
+ author
71
+ categories
72
+ comment_rss
73
+ content
74
+ entry_id
75
+ published
76
+ summary
77
+ title
78
+ url
79
+ )
80
+ expect(all_fields.sort).to eq expected_fields
64
81
  end
65
82
 
66
- it "should support checking if a field exists in the entry" do
83
+ it 'should support checking if a field exists in the entry' do
67
84
  expect(@entry).to include 'title'
68
85
  expect(@entry).to include 'author'
69
86
  end
70
87
 
71
- it "should allow access to fields with hash syntax" do
72
- expect(@entry['title']).to eq "Nokogiri’s Slop Feature"
73
- expect(@entry['author']).to eq "Aaron Patterson"
88
+ it 'should allow access to fields with hash syntax' do
89
+ expect(@entry['title']).to eq 'Nokogiri’s Slop Feature'
90
+ expect(@entry['author']).to eq 'Aaron Patterson'
74
91
  end
75
92
 
76
- it "should allow setting field values with hash syntax" do
77
- @entry['title'] = "Foobar"
78
- expect(@entry.title).to eq "Foobar"
93
+ it 'should allow setting field values with hash syntax' do
94
+ @entry['title'] = 'Foobar'
95
+ expect(@entry.title).to eq 'Foobar'
79
96
  end
80
97
  end
@@ -1,80 +1,102 @@
1
- # coding: utf-8
2
- require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
1
+ require 'spec_helper'
3
2
 
4
3
  describe Feedjira::Parser::RSSFeedBurnerEntry do
5
4
  before(:each) do
6
- # I don't really like doing it this way because these unit test should only rely on RSSEntry,
7
- # but this is actually how it should work. You would never just pass entry xml straight to the AtomEnry
8
- @entry = Feedjira::Parser::RSSFeedBurner.parse(sample_rss_feed_burner_feed).entries.first
9
- Feedjira::Feed.add_common_feed_entry_element("wfw:commentRss", :as => :comment_rss)
5
+ tag = 'wfw:commentRss'
6
+ Feedjira::Feed.add_common_feed_entry_element(tag, as: :comment_rss)
7
+ # I don't really like doing it this way because these unit test should only
8
+ # rely on RSSEntry, but this is actually how it should work. You would
9
+ # never just pass entry xml straight to the AtomEnry
10
+ feed = Feedjira::Parser::RSSFeedBurner.parse sample_rss_feed_burner_feed
11
+ @entry = feed.entries.first
10
12
  end
11
13
 
12
14
  after(:each) do
13
15
  # We change the title in one or more specs to test []=
14
- if @entry.title != "Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M"
15
- @entry.title = Feedjira::Parser::RSS.parse(sample_rss_feed_burner_feed).entries.first.title
16
+ if @entry.title != 'Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M' # rubocop:disable Metrics/LineLength
17
+ feed = Feedjira::Parser::RSS.parse sample_rss_feed_burner_feed
18
+ @entry.title = feed.entries.first.title
16
19
  end
17
20
  end
18
21
 
19
- it "should parse the title" do
20
- expect(@entry.title).to eq "Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M"
22
+ it 'should parse the title' do
23
+ title = 'Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M' # rubocop:disable Metrics/LineLength
24
+ expect(@entry.title).to eq title
21
25
  end
22
26
 
23
- it "should parse the original url" do
24
- expect(@entry.url).to eq "http://techcrunch.com/2011/11/02/angies-list-prices-ipo-at-11-to-13-per-share-valued-at-over-600m/"
27
+ it 'should parse the original url' do
28
+ expect(@entry.url).to eq 'http://techcrunch.com/2011/11/02/angies-list-prices-ipo-at-11-to-13-per-share-valued-at-over-600m/'
25
29
  end
26
30
 
27
- it "should parse the author" do
28
- expect(@entry.author).to eq "Leena Rao"
31
+ it 'should parse the author' do
32
+ expect(@entry.author).to eq 'Leena Rao'
29
33
  end
30
34
 
31
- it "should parse the content" do
35
+ it 'should parse the content' do
32
36
  expect(@entry.content).to eq sample_rss_feed_burner_entry_content
33
37
  end
34
38
 
35
- it "should provide a summary" do
39
+ it 'should provide a summary' do
36
40
  expect(@entry.summary).to eq sample_rss_feed_burner_entry_description
37
41
  end
38
42
 
39
- it "should parse the published date" do
40
- expect(@entry.published).to eq Time.parse_safely("Wed Nov 02 17:25:27 UTC 2011")
43
+ it 'should parse the published date' do
44
+ published = Time.parse_safely 'Wed Nov 02 17:25:27 UTC 2011'
45
+ expect(@entry.published).to eq published
41
46
  end
42
47
 
43
- it "should parse the categories" do
44
- expect(@entry.categories).to eq ["TC", "angie\\'s list"]
48
+ it 'should parse the categories' do
49
+ expect(@entry.categories).to eq ['TC', "angie\\'s list"]
45
50
  end
46
51
 
47
- it "should parse the guid as id" do
48
- expect(@entry.id).to eq "http://techcrunch.com/?p=446154"
52
+ it 'should parse the guid as id' do
53
+ expect(@entry.id).to eq 'http://techcrunch.com/?p=446154'
49
54
  end
50
55
 
51
- it "should support each" do
56
+ it 'should support each' do
52
57
  expect(@entry).to respond_to :each
53
58
  end
54
59
 
55
- it "should be able to list out all fields with each" do
60
+ it 'should be able to list out all fields with each' do
56
61
  all_fields = []
57
62
  title_value = ''
63
+
58
64
  @entry.each do |field, value|
59
65
  all_fields << field
60
66
  title_value = value if field == 'title'
61
67
  end
62
- expect(all_fields.sort).to eq ["author", "categories", "comment_rss", "content", "entry_id", "image", "published", "summary", "title", "url"]
63
- expect(title_value).to eq "Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M"
68
+
69
+ title = 'Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M' # rubocop:disable Metrics/LineLength
70
+ expect(title_value).to eq title
71
+
72
+ expected_fields = %w(
73
+ author
74
+ categories
75
+ comment_rss
76
+ content
77
+ entry_id
78
+ image
79
+ published
80
+ summary
81
+ title
82
+ url
83
+ )
84
+ expect(all_fields.sort).to eq expected_fields
64
85
  end
65
86
 
66
- it "should support checking if a field exists in the entry" do
87
+ it 'should support checking if a field exists in the entry' do
67
88
  expect(@entry).to include 'author'
68
89
  expect(@entry).to include 'title'
69
90
  end
70
91
 
71
- it "should allow access to fields with hash syntax" do
72
- expect(@entry['author']).to eq "Leena Rao"
73
- expect(@entry['title']).to eq "Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M"
92
+ it 'should allow access to fields with hash syntax' do
93
+ expect(@entry['author']).to eq 'Leena Rao'
94
+ title = 'Angie’s List Sets Price Range IPO At $11 To $13 Per Share; Valued At Over $600M' # rubocop:disable Metrics/LineLength
95
+ expect(@entry['title']).to eq title
74
96
  end
75
97
 
76
- it "should allow setting field values with hash syntax" do
77
- @entry['title'] = "Foobar"
78
- expect(@entry.title).to eq "Foobar"
98
+ it 'should allow setting field values with hash syntax' do
99
+ @entry['title'] = 'Foobar'
100
+ expect(@entry.title).to eq 'Foobar'
79
101
  end
80
102
  end
@@ -1,56 +1,61 @@
1
- require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
1
+ require 'spec_helper'
2
2
 
3
- describe Feedjira::Parser::RSSFeedBurner do
4
- describe "#will_parse?" do
5
- it "should return true for a feedburner rss feed" do
6
- expect(Feedjira::Parser::RSSFeedBurner).to be_able_to_parse(sample_rss_feed_burner_feed)
3
+ module Feedjira::Parser
4
+ describe '#will_parse?' do
5
+ it 'should return true for a feedburner rss feed' do
6
+ expect(RSSFeedBurner).to be_able_to_parse sample_rss_feed_burner_feed
7
7
  end
8
8
 
9
- it "should return false for a regular RSS feed" do
10
- expect(Feedjira::Parser::RSSFeedBurner).to_not be_able_to_parse(sample_rss_feed)
11
- end
9
+ it 'should return false for a regular RSS feed' do
10
+ expect(RSSFeedBurner).to_not be_able_to_parse sample_rss_feed
11
+ end
12
12
 
13
- it "should return false for a feedburner atom feed" do
14
- expect(Feedjira::Parser::RSSFeedBurner).to_not be_able_to_parse(sample_feedburner_atom_feed)
13
+ it 'should return false for a feedburner atom feed' do
14
+ expect(RSSFeedBurner).to_not be_able_to_parse sample_feedburner_atom_feed
15
15
  end
16
16
 
17
- it "should return false for an rdf feed" do
18
- expect(Feedjira::Parser::RSSFeedBurner).to_not be_able_to_parse(sample_rdf_feed)
17
+ it 'should return false for an rdf feed' do
18
+ expect(RSSFeedBurner).to_not be_able_to_parse sample_rdf_feed
19
19
  end
20
20
 
21
- it "should return false for a regular atom feed" do
22
- expect(Feedjira::Parser::RSSFeedBurner).to_not be_able_to_parse(sample_atom_feed)
21
+ it 'should return false for a regular atom feed' do
22
+ expect(RSSFeedBurner).to_not be_able_to_parse sample_atom_feed
23
23
  end
24
24
  end
25
25
 
26
- describe "parsing" do
26
+ describe 'parsing' do
27
27
  before(:each) do
28
- @feed = Feedjira::Parser::RSSFeedBurner.parse(sample_rss_feed_burner_feed)
28
+ @feed = RSSFeedBurner.parse(sample_rss_feed_burner_feed)
29
+ end
30
+
31
+ it 'should parse the title' do
32
+ expect(@feed.title).to eq 'TechCrunch'
29
33
  end
30
34
 
31
- it "should parse the title" do
32
- expect(@feed.title).to eq "TechCrunch"
35
+ it 'should parse the description' do
36
+ description = 'TechCrunch is a group-edited blog that profiles the companies, products and events defining and transforming the new web.' # rubocop:disable Metrics/LineLength
37
+ expect(@feed.description).to eq description
33
38
  end
34
39
 
35
- it "should parse the description" do
36
- expect(@feed.description).to eq "TechCrunch is a group-edited blog that profiles the companies, products and events defining and transforming the new web."
40
+ it 'should parse the url' do
41
+ expect(@feed.url).to eq 'http://techcrunch.com'
37
42
  end
38
43
 
39
- it "should parse the url" do
40
- expect(@feed.url).to eq "http://techcrunch.com"
44
+ it 'should parse the last build date' do
45
+ expect(@feed.last_built).to eq 'Wed, 02 Nov 2011 17:29:59 +0000'
41
46
  end
42
47
 
43
- it "should parse the hub urls" do
48
+ it 'should parse the hub urls' do
44
49
  expect(@feed.hubs.count).to eq 2
45
- expect(@feed.hubs.first).to eq "http://pubsubhubbub.appspot.com/"
50
+ expect(@feed.hubs.first).to eq 'http://pubsubhubbub.appspot.com/'
46
51
  end
47
52
 
48
- it "should provide an accessor for the feed_url" do
53
+ it 'should provide an accessor for the feed_url' do
49
54
  expect(@feed).to respond_to :feed_url
50
55
  expect(@feed).to respond_to :feed_url=
51
56
  end
52
57
 
53
- it "should parse entries" do
58
+ it 'should parse entries' do
54
59
  expect(@feed.entries.size).to eq 20
55
60
  end
56
61
  end
@@ -1,57 +1,89 @@
1
- require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
1
+ require 'spec_helper'
2
2
 
3
3
  describe Feedjira::Parser::RSS do
4
- describe "#will_parse?" do
5
- it "should return true for an RSS feed" do
4
+ describe '#will_parse?' do
5
+ it 'should return true for an RSS feed' do
6
6
  expect(Feedjira::Parser::RSS).to be_able_to_parse(sample_rss_feed)
7
7
  end
8
8
 
9
- # this is no longer true. combined rdf and rss into one
10
- # it "should return false for an rdf feed" do
11
- # Feedjira::RSS.should_not be_able_to_parse(sample_rdf_feed)
12
- # end
13
-
14
- it "should return false for an atom feed" do
9
+ it 'should return false for an atom feed' do
15
10
  expect(Feedjira::Parser::RSS).to_not be_able_to_parse(sample_atom_feed)
16
11
  end
17
12
 
18
- it "should return false for an rss feedburner feed" do
19
- expect(Feedjira::Parser::RSS).to_not be_able_to_parse(sample_rss_feed_burner_feed)
13
+ it 'should return false for an rss feedburner feed' do
14
+ able = Feedjira::Parser::RSS.able_to_parse? sample_rss_feed_burner_feed
15
+ expect(able).to eq false
20
16
  end
21
17
  end
22
18
 
23
- describe "parsing" do
19
+ describe 'parsing' do
24
20
  before(:each) do
25
21
  @feed = Feedjira::Parser::RSS.parse(sample_rss_feed)
26
22
  end
27
23
 
28
- it "should parse the version" do
29
- expect(@feed.version).to eq "2.0"
24
+ it 'should parse the version' do
25
+ expect(@feed.version).to eq '2.0'
26
+ end
27
+
28
+ it 'should parse the title' do
29
+ expect(@feed.title).to eq 'Tender Lovemaking'
30
+ end
31
+
32
+ it 'should parse the description' do
33
+ expect(@feed.description).to eq 'The act of making love, tenderly.'
30
34
  end
31
35
 
32
- it "should parse the title" do
33
- expect(@feed.title).to eq "Tender Lovemaking"
36
+ it 'should parse the url' do
37
+ expect(@feed.url).to eq 'http://tenderlovemaking.com'
34
38
  end
35
39
 
36
- it "should parse the description" do
37
- expect(@feed.description).to eq "The act of making love, tenderly."
40
+ it 'should parse the ttl' do
41
+ expect(@feed.ttl).to eq '60'
38
42
  end
39
43
 
40
- it "should parse the url" do
41
- expect(@feed.url).to eq "http://tenderlovemaking.com"
44
+ it 'should parse the last build date' do
45
+ expect(@feed.last_built).to eq 'Sat, 07 Sep 2002 09:42:31 GMT'
42
46
  end
43
47
 
44
- it "should parse the hub urls" do
48
+ it 'should parse the hub urls' do
45
49
  expect(@feed.hubs.count).to eq 1
46
- expect(@feed.hubs.first).to eq "http://pubsubhubbub.appspot.com/"
50
+ expect(@feed.hubs.first).to eq 'http://pubsubhubbub.appspot.com/'
47
51
  end
48
52
 
49
- it "should provide an accessor for the feed_url" do
53
+ it 'should provide an accessor for the feed_url' do
50
54
  expect(@feed).to respond_to :feed_url
51
55
  expect(@feed).to respond_to :feed_url=
52
56
  end
53
57
 
54
- it "should parse entries" do
58
+ it 'should parse the language' do
59
+ expect(@feed.language).to eq 'en'
60
+ end
61
+
62
+ it 'should parse the image url' do
63
+ expect(@feed.image.url).to eq 'https://tenderlovemaking.com/images/header-logo-text-trimmed.png'
64
+ end
65
+
66
+ it 'should parse the image title' do
67
+ expect(@feed.image.title).to eq 'Tender Lovemaking'
68
+ end
69
+
70
+ it 'should parse the image link' do
71
+ expect(@feed.image.link).to eq 'http://tenderlovemaking.com'
72
+ end
73
+
74
+ it 'should parse the image width' do
75
+ expect(@feed.image.width).to eq '766'
76
+ end
77
+
78
+ it 'should parse the image height' do
79
+ expect(@feed.image.height).to eq '138'
80
+ end
81
+
82
+ it 'should parse the image description' do
83
+ expect(@feed.image.description).to eq 'The act of making love, tenderly.'
84
+ end
85
+
86
+ it 'should parse entries' do
55
87
  expect(@feed.entries.size).to eq 10
56
88
  end
57
89
  end