feedjira 2.2.0 → 3.1.2

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 (91) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/feed-parsing.md +15 -0
  3. data/.rubocop.yml +32 -8
  4. data/.rubocop_todo.yml +11 -0
  5. data/.travis.yml +3 -7
  6. data/CHANGELOG.md +18 -9
  7. data/CODE_OF_CONDUCT.md +74 -0
  8. data/Gemfile +8 -5
  9. data/README.md +46 -99
  10. data/Rakefile +8 -6
  11. data/feedjira.gemspec +31 -20
  12. data/lib/feedjira.rb +75 -41
  13. data/lib/feedjira/atom_entry_utilities.rb +51 -0
  14. data/lib/feedjira/configuration.rb +8 -10
  15. data/lib/feedjira/core_ext.rb +5 -3
  16. data/lib/feedjira/core_ext/date.rb +2 -1
  17. data/lib/feedjira/core_ext/string.rb +2 -1
  18. data/lib/feedjira/core_ext/time.rb +12 -12
  19. data/lib/feedjira/date_time_utilities.rb +8 -10
  20. data/lib/feedjira/date_time_utilities/date_time_epoch_parser.rb +3 -2
  21. data/lib/feedjira/date_time_utilities/date_time_language_parser.rb +4 -4
  22. data/lib/feedjira/date_time_utilities/date_time_pattern_parser.rb +11 -15
  23. data/lib/feedjira/feed.rb +12 -82
  24. data/lib/feedjira/feed_entry_utilities.rb +14 -7
  25. data/lib/feedjira/feed_utilities.rb +5 -4
  26. data/lib/feedjira/parser.rb +6 -1
  27. data/lib/feedjira/parser/atom.rb +6 -5
  28. data/lib/feedjira/parser/atom_entry.rb +4 -21
  29. data/lib/feedjira/parser/atom_feed_burner.rb +7 -6
  30. data/lib/feedjira/parser/atom_feed_burner_entry.rb +7 -18
  31. data/lib/feedjira/parser/atom_google_alerts.rb +26 -0
  32. data/lib/feedjira/parser/atom_google_alerts_entry.rb +21 -0
  33. data/lib/feedjira/parser/atom_youtube.rb +4 -3
  34. data/lib/feedjira/parser/atom_youtube_entry.rb +9 -8
  35. data/lib/feedjira/parser/globally_unique_identifier.rb +21 -0
  36. data/lib/feedjira/parser/google_docs_atom.rb +6 -6
  37. data/lib/feedjira/parser/google_docs_atom_entry.rb +3 -19
  38. data/lib/feedjira/parser/itunes_rss.rb +4 -3
  39. data/lib/feedjira/parser/itunes_rss_category.rb +6 -5
  40. data/lib/feedjira/parser/itunes_rss_item.rb +5 -8
  41. data/lib/feedjira/parser/itunes_rss_owner.rb +2 -1
  42. data/lib/feedjira/parser/json_feed.rb +41 -0
  43. data/lib/feedjira/parser/json_feed_item.rb +57 -0
  44. data/lib/feedjira/parser/podlove_chapter.rb +4 -3
  45. data/lib/feedjira/parser/rss.rb +5 -3
  46. data/lib/feedjira/parser/rss_entry.rb +3 -24
  47. data/lib/feedjira/parser/rss_feed_burner.rb +4 -3
  48. data/lib/feedjira/parser/rss_feed_burner_entry.rb +6 -26
  49. data/lib/feedjira/parser/rss_image.rb +2 -0
  50. data/lib/feedjira/preprocessor.rb +4 -4
  51. data/lib/feedjira/rss_entry_utilities.rb +53 -0
  52. data/lib/feedjira/version.rb +3 -1
  53. data/spec/feedjira/configuration_spec.rb +11 -16
  54. data/spec/feedjira/date_time_utilities_spec.rb +22 -20
  55. data/spec/feedjira/feed_entry_utilities_spec.rb +20 -18
  56. data/spec/feedjira/feed_spec.rb +17 -229
  57. data/spec/feedjira/feed_utilities_spec.rb +75 -73
  58. data/spec/feedjira/parser/atom_entry_spec.rb +41 -38
  59. data/spec/feedjira/parser/atom_feed_burner_entry_spec.rb +22 -20
  60. data/spec/feedjira/parser/atom_feed_burner_spec.rb +122 -118
  61. data/spec/feedjira/parser/atom_google_alerts_entry_spec.rb +34 -0
  62. data/spec/feedjira/parser/atom_google_alerts_spec.rb +62 -0
  63. data/spec/feedjira/parser/atom_spec.rb +83 -77
  64. data/spec/feedjira/parser/atom_youtube_entry_spec.rb +41 -39
  65. data/spec/feedjira/parser/atom_youtube_spec.rb +21 -19
  66. data/spec/feedjira/parser/google_docs_atom_entry_spec.rb +10 -8
  67. data/spec/feedjira/parser/google_docs_atom_spec.rb +25 -21
  68. data/spec/feedjira/parser/itunes_rss_item_spec.rb +39 -37
  69. data/spec/feedjira/parser/itunes_rss_owner_spec.rb +7 -5
  70. data/spec/feedjira/parser/itunes_rss_spec.rb +120 -116
  71. data/spec/feedjira/parser/json_feed_item_spec.rb +81 -0
  72. data/spec/feedjira/parser/json_feed_spec.rb +55 -0
  73. data/spec/feedjira/parser/podlove_chapter_spec.rb +14 -12
  74. data/spec/feedjira/parser/rss_entry_spec.rb +56 -34
  75. data/spec/feedjira/parser/rss_feed_burner_entry_spec.rb +36 -34
  76. data/spec/feedjira/parser/rss_feed_burner_spec.rb +49 -45
  77. data/spec/feedjira/parser/rss_spec.rb +38 -36
  78. data/spec/feedjira/preprocessor_spec.rb +9 -7
  79. data/spec/feedjira_spec.rb +166 -0
  80. data/spec/sample_feeds.rb +32 -29
  81. data/spec/sample_feeds/HuffPostCanada.xml +279 -0
  82. data/spec/sample_feeds/Permalinks.xml +22 -0
  83. data/spec/sample_feeds/a10.xml +72 -0
  84. data/spec/sample_feeds/google_alerts_atom.xml +1 -0
  85. data/spec/sample_feeds/json_feed.json +156 -0
  86. data/spec/spec_helper.rb +7 -5
  87. metadata +59 -70
  88. data/Dangerfile +0 -1
  89. data/fixtures/vcr_cassettes/fetch_failure.yml +0 -62
  90. data/fixtures/vcr_cassettes/parse_error.yml +0 -222
  91. data/fixtures/vcr_cassettes/success.yml +0 -281
@@ -1,86 +1,88 @@
1
- require File.join(File.dirname(__FILE__), %w(.. .. spec_helper))
1
+ # frozen_string_literal: true
2
+
3
+ require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
2
4
 
3
5
  describe Feedjira::Parser::AtomYoutubeEntry do
4
- describe 'parsing' do
6
+ describe "parsing" do
5
7
  before do
6
8
  @feed = Feedjira::Parser::AtomYoutube.parse(sample_youtube_atom_feed)
7
9
  @entry = @feed.entries.first
8
10
  end
9
11
 
10
- it 'should have the title' do
11
- expect(@entry.title).to eq 'The Google app: Questions Title'
12
+ it "should have the title" do
13
+ expect(@entry.title).to eq "The Google app: Questions Title"
12
14
  end
13
15
 
14
- it 'should have the url' do
15
- expect(@entry.url).to eq 'http://www.youtube.com/watch?v=5shykyfmb28'
16
+ it "should have the url" do
17
+ expect(@entry.url).to eq "http://www.youtube.com/watch?v=5shykyfmb28"
16
18
  end
17
19
 
18
- it 'should have the entry id' do
19
- expect(@entry.entry_id).to eq 'yt:video:5shykyfmb28'
20
+ it "should have the entry id" do
21
+ expect(@entry.entry_id).to eq "yt:video:5shykyfmb28"
20
22
  end
21
23
 
22
- it 'should have the published date' do
23
- expect(@entry.published).to eq Time.parse_safely('2015-05-04T00:01:27+00:00') # rubocop:disable Metrics/LineLength
24
+ it "should have the published date" do
25
+ expect(@entry.published).to eq Time.parse_safely("2015-05-04T00:01:27+00:00")
24
26
  end
25
27
 
26
- it 'should have the updated date' do
27
- expect(@entry.updated).to eq Time.parse_safely('2015-05-13T17:38:30+00:00') # rubocop:disable Metrics/LineLength
28
+ it "should have the updated date" do
29
+ expect(@entry.updated).to eq Time.parse_safely("2015-05-13T17:38:30+00:00")
28
30
  end
29
31
 
30
- it 'should have the content populated from the media:description element' do
31
- expect(@entry.content).to eq 'A question is the most powerful force in the world. It can start you on an adventure or spark a connection. See where a question can take you. The Google app is available on iOS and Android. Download the app here: http://www.google.com/search/about/download' # rubocop:disable Metrics/LineLength
32
+ it "should have the content populated from the media:description element" do
33
+ expect(@entry.content).to eq "A question is the most powerful force in the world. It can start you on an adventure or spark a connection. See where a question can take you. The Google app is available on iOS and Android. Download the app here: http://www.google.com/search/about/download"
32
34
  end
33
35
 
34
- it 'should have the summary but blank' do
36
+ it "should have the summary but blank" do
35
37
  expect(@entry.summary).to be_nil
36
38
  end
37
39
 
38
- it 'should have the custom youtube video id' do
39
- expect(@entry.youtube_video_id).to eq '5shykyfmb28'
40
+ it "should have the custom youtube video id" do
41
+ expect(@entry.youtube_video_id).to eq "5shykyfmb28"
40
42
  end
41
43
 
42
- it 'should have the custom media title' do
43
- expect(@entry.media_title).to eq 'The Google app: Questions'
44
+ it "should have the custom media title" do
45
+ expect(@entry.media_title).to eq "The Google app: Questions"
44
46
  end
45
47
 
46
- it 'should have the custom media url' do
47
- expect(@entry.media_url).to eq 'https://www.youtube.com/v/5shykyfmb28?version=3' # rubocop:disable Metrics/LineLength
48
+ it "should have the custom media url" do
49
+ expect(@entry.media_url).to eq "https://www.youtube.com/v/5shykyfmb28?version=3"
48
50
  end
49
51
 
50
- it 'should have the custom media type' do
51
- expect(@entry.media_type).to eq 'application/x-shockwave-flash'
52
+ it "should have the custom media type" do
53
+ expect(@entry.media_type).to eq "application/x-shockwave-flash"
52
54
  end
53
55
 
54
- it 'should have the custom media width' do
55
- expect(@entry.media_width).to eq '640'
56
+ it "should have the custom media width" do
57
+ expect(@entry.media_width).to eq "640"
56
58
  end
57
59
 
58
- it 'should have the custom media height' do
59
- expect(@entry.media_height).to eq '390'
60
+ it "should have the custom media height" do
61
+ expect(@entry.media_height).to eq "390"
60
62
  end
61
63
 
62
- it 'should have the custom media thumbnail url' do
63
- expect(@entry.media_thumbnail_url).to eq 'https://i2.ytimg.com/vi/5shykyfmb28/hqdefault.jpg' # rubocop:disable Metrics/LineLength
64
+ it "should have the custom media thumbnail url" do
65
+ expect(@entry.media_thumbnail_url).to eq "https://i2.ytimg.com/vi/5shykyfmb28/hqdefault.jpg"
64
66
  end
65
67
 
66
- it 'should have the custom media thumbnail width' do
67
- expect(@entry.media_thumbnail_width).to eq '480'
68
+ it "should have the custom media thumbnail width" do
69
+ expect(@entry.media_thumbnail_width).to eq "480"
68
70
  end
69
71
 
70
- it 'should have the custom media thumbnail height' do
71
- expect(@entry.media_thumbnail_height).to eq '360'
72
+ it "should have the custom media thumbnail height" do
73
+ expect(@entry.media_thumbnail_height).to eq "360"
72
74
  end
73
75
 
74
- it 'should have the custom media star count' do
75
- expect(@entry.media_star_count).to eq '3546'
76
+ it "should have the custom media star count" do
77
+ expect(@entry.media_star_count).to eq "3546"
76
78
  end
77
79
 
78
- it 'should have the custom media star average' do
79
- expect(@entry.media_star_average).to eq '4.79'
80
+ it "should have the custom media star average" do
81
+ expect(@entry.media_star_average).to eq "4.79"
80
82
  end
81
83
 
82
- it 'should have the custom media views' do
83
- expect(@entry.media_views).to eq '251497'
84
+ it "should have the custom media views" do
85
+ expect(@entry.media_views).to eq "251497"
84
86
  end
85
87
  end
86
88
  end
@@ -1,43 +1,45 @@
1
- require File.join(File.dirname(__FILE__), %w(.. .. spec_helper))
1
+ # frozen_string_literal: true
2
+
3
+ require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
2
4
 
3
5
  describe Feedjira::Parser::AtomYoutube do
4
- describe '#will_parse?' do
5
- it 'should return true for an atom youtube feed' do
6
- expect(Feedjira::Parser::AtomYoutube).to be_able_to_parse(sample_youtube_atom_feed) # rubocop:disable Metrics/LineLength
6
+ describe "#will_parse?" do
7
+ it "should return true for an atom youtube feed" do
8
+ expect(Feedjira::Parser::AtomYoutube).to be_able_to_parse(sample_youtube_atom_feed)
7
9
  end
8
10
 
9
- it 'should return fase for an atom feed' do
10
- expect(Feedjira::Parser::AtomYoutube).to_not be_able_to_parse(sample_atom_feed) # rubocop:disable Metrics/LineLength
11
+ it "should return fase for an atom feed" do
12
+ expect(Feedjira::Parser::AtomYoutube).to_not be_able_to_parse(sample_atom_feed)
11
13
  end
12
14
 
13
- it 'should return false for an rss feedburner feed' do
14
- expect(Feedjira::Parser::AtomYoutube).to_not be_able_to_parse(sample_rss_feed_burner_feed) # rubocop:disable Metrics/LineLength
15
+ it "should return false for an rss feedburner feed" do
16
+ expect(Feedjira::Parser::AtomYoutube).to_not be_able_to_parse(sample_rss_feed_burner_feed)
15
17
  end
16
18
  end
17
19
 
18
- describe 'parsing' do
20
+ describe "parsing" do
19
21
  before(:each) do
20
22
  @feed = Feedjira::Parser::AtomYoutube.parse(sample_youtube_atom_feed)
21
23
  end
22
24
 
23
- it 'should parse the title' do
24
- expect(@feed.title).to eq 'Google'
25
+ it "should parse the title" do
26
+ expect(@feed.title).to eq "Google"
25
27
  end
26
28
 
27
- it 'should parse the author' do
28
- expect(@feed.author).to eq 'Google Author'
29
+ it "should parse the author" do
30
+ expect(@feed.author).to eq "Google Author"
29
31
  end
30
32
 
31
- it 'should parse the url' do
32
- expect(@feed.url).to eq 'http://www.youtube.com/user/Google'
33
+ it "should parse the url" do
34
+ expect(@feed.url).to eq "http://www.youtube.com/user/Google"
33
35
  end
34
36
 
35
- it 'should parse the feed_url' do
36
- expect(@feed.feed_url).to eq 'http://www.youtube.com/feeds/videos.xml?user=google'
37
+ it "should parse the feed_url" do
38
+ expect(@feed.feed_url).to eq "http://www.youtube.com/feeds/videos.xml?user=google"
37
39
  end
38
40
 
39
- it 'should parse the YouTube channel id' do
40
- expect(@feed.youtube_channel_id).to eq 'UCK8sQmJBp8GCxrOtXWBpyEA'
41
+ it "should parse the YouTube channel id" do
42
+ expect(@feed.youtube_channel_id).to eq "UCK8sQmJBp8GCxrOtXWBpyEA"
41
43
  end
42
44
  end
43
45
  end
@@ -1,23 +1,25 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
2
4
 
3
5
  describe Feedjira::Parser::GoogleDocsAtomEntry do
4
- describe 'parsing' do
6
+ describe "parsing" do
5
7
  before do
6
8
  xml = sample_google_docs_list_feed
7
9
  @feed = Feedjira::Parser::GoogleDocsAtom.parse xml
8
10
  @entry = @feed.entries.first
9
11
  end
10
12
 
11
- it 'should have the custom checksum element' do
12
- expect(@entry.checksum).to eq '2b01142f7481c7b056c4b410d28f33cf'
13
+ it "should have the custom checksum element" do
14
+ expect(@entry.checksum).to eq "2b01142f7481c7b056c4b410d28f33cf"
13
15
  end
14
16
 
15
- it 'should have the custom filename element' do
16
- expect(@entry.original_filename).to eq 'MyFile.pdf'
17
+ it "should have the custom filename element" do
18
+ expect(@entry.original_filename).to eq "MyFile.pdf"
17
19
  end
18
20
 
19
- it 'should have the custom suggested filename element' do
20
- expect(@entry.suggested_filename).to eq 'TaxDocument.pdf'
21
+ it "should have the custom suggested filename element" do
22
+ expect(@entry.suggested_filename).to eq "TaxDocument.pdf"
21
23
  end
22
24
  end
23
25
  end
@@ -1,31 +1,35 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
2
 
3
- module Feedjira::Parser
4
- describe '.able_to_parser?' do
5
- it 'should return true for Google Docs feed' do
6
- expect(GoogleDocsAtom).to be_able_to_parse(sample_google_docs_list_feed)
7
- end
3
+ require "spec_helper"
8
4
 
9
- it 'should not be able to parse another Atom feed' do
10
- expect(GoogleDocsAtom).to_not be_able_to_parse(sample_atom_feed)
11
- end
12
- end
5
+ module Feedjira
6
+ module Parser
7
+ describe ".able_to_parser?" do
8
+ it "should return true for Google Docs feed" do
9
+ expect(GoogleDocsAtom).to be_able_to_parse(sample_google_docs_list_feed)
10
+ end
13
11
 
14
- describe 'parsing' do
15
- before do
16
- @feed = GoogleDocsAtom.parse(sample_google_docs_list_feed)
12
+ it "should not be able to parse another Atom feed" do
13
+ expect(GoogleDocsAtom).to_not be_able_to_parse(sample_atom_feed)
14
+ end
17
15
  end
18
16
 
19
- it 'should return a bunch of objects' do
20
- expect(@feed.entries).to_not be_empty
21
- end
17
+ describe "parsing" do
18
+ before do
19
+ @feed = GoogleDocsAtom.parse(sample_google_docs_list_feed)
20
+ end
22
21
 
23
- it 'should populate a title, interhited from the Atom entry' do
24
- expect(@feed.title).to_not be_nil
25
- end
22
+ it "should return a bunch of objects" do
23
+ expect(@feed.entries).to_not be_empty
24
+ end
25
+
26
+ it "should populate a title, interhited from the Atom entry" do
27
+ expect(@feed.title).to_not be_nil
28
+ end
26
29
 
27
- it 'should return a bunch of entries of type GoogleDocsAtomEntry' do
28
- expect(@feed.entries.first).to be_a GoogleDocsAtomEntry
30
+ it "should return a bunch of entries of type GoogleDocsAtomEntry" do
31
+ expect(@feed.entries.first).to be_a GoogleDocsAtomEntry
32
+ end
29
33
  end
30
34
  end
31
35
  end
@@ -1,4 +1,6 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
2
4
 
3
5
  describe Feedjira::Parser::ITunesRSSItem do
4
6
  before(:each) do
@@ -8,76 +10,76 @@ describe Feedjira::Parser::ITunesRSSItem do
8
10
  @item = Feedjira::Parser::ITunesRSS.parse(sample_itunes_feed).entries.first
9
11
  end
10
12
 
11
- it 'should parse the title' do
12
- expect(@item.title).to eq 'Shake Shake Shake Your Spices'
13
+ it "should parse the title" do
14
+ expect(@item.title).to eq "Shake Shake Shake Your Spices"
13
15
  end
14
16
 
15
- it 'should parse the itunes title' do
16
- expect(@item.itunes_title).to eq 'Shake Shake Shake Your Spices'
17
+ it "should parse the itunes title" do
18
+ expect(@item.itunes_title).to eq "Shake Shake Shake Your Spices"
17
19
  end
18
20
 
19
- it 'should parse the author' do
20
- expect(@item.itunes_author).to eq 'John Doe'
21
+ it "should parse the author" do
22
+ expect(@item.itunes_author).to eq "John Doe"
21
23
  end
22
24
 
23
- it 'should parse the subtitle' do
24
- expect(@item.itunes_subtitle).to eq 'A short primer on table spices'
25
+ it "should parse the subtitle" do
26
+ expect(@item.itunes_subtitle).to eq "A short primer on table spices"
25
27
  end
26
28
 
27
- it 'should parse the summary' do
28
- summary = 'This week we talk about salt and pepper shakers, comparing and contrasting pour rates, construction materials, and overall aesthetics. Come and join the party!' # rubocop:disable Metrics/LineLength
29
+ it "should parse the summary" do
30
+ summary = "This week we talk about salt and pepper shakers, comparing and contrasting pour rates, construction materials, and overall aesthetics. Come and join the party!"
29
31
  expect(@item.itunes_summary).to eq summary
30
32
  end
31
33
 
32
- it 'should parse the itunes season' do
33
- expect(@item.itunes_season).to eq '1'
34
+ it "should parse the itunes season" do
35
+ expect(@item.itunes_season).to eq "1"
34
36
  end
35
37
 
36
- it 'should parse the itunes episode number' do
37
- expect(@item.itunes_episode).to eq '3'
38
+ it "should parse the itunes episode number" do
39
+ expect(@item.itunes_episode).to eq "3"
38
40
  end
39
41
 
40
- it 'should parse the itunes episode type' do
41
- expect(@item.itunes_episode_type).to eq 'full'
42
+ it "should parse the itunes episode type" do
43
+ expect(@item.itunes_episode_type).to eq "full"
42
44
  end
43
45
 
44
- it 'should parse the enclosure' do
45
- expect(@item.enclosure_length).to eq '8727310'
46
- expect(@item.enclosure_type).to eq 'audio/x-m4a'
47
- expect(@item.enclosure_url).to eq 'http://example.com/podcasts/everything/AllAboutEverythingEpisode3.m4a'
46
+ it "should parse the enclosure" do
47
+ expect(@item.enclosure_length).to eq "8727310"
48
+ expect(@item.enclosure_type).to eq "audio/x-m4a"
49
+ expect(@item.enclosure_url).to eq "http://example.com/podcasts/everything/AllAboutEverythingEpisode3.m4a"
48
50
  end
49
51
 
50
- it 'should parse the guid as id' do
51
- expect(@item.id).to eq 'http://example.com/podcasts/archive/aae20050615.m4a'
52
+ it "should parse the guid as id" do
53
+ expect(@item.id).to eq "http://example.com/podcasts/archive/aae20050615.m4a"
52
54
  end
53
55
 
54
- it 'should parse the published date' do
55
- published = Time.parse_safely 'Wed Jun 15 19:00:00 UTC 2005'
56
+ it "should parse the published date" do
57
+ published = Time.parse_safely "Wed Jun 15 19:00:00 UTC 2005"
56
58
  expect(@item.published).to eq published
57
59
  end
58
60
 
59
- it 'should parse the duration' do
60
- expect(@item.itunes_duration).to eq '7:04'
61
+ it "should parse the duration" do
62
+ expect(@item.itunes_duration).to eq "7:04"
61
63
  end
62
64
 
63
- it 'should parse the keywords' do
64
- expect(@item.itunes_keywords).to eq 'salt, pepper, shaker, exciting'
65
+ it "should parse the keywords" do
66
+ expect(@item.itunes_keywords).to eq "salt, pepper, shaker, exciting"
65
67
  end
66
68
 
67
- it 'should parse the image' do
68
- expect(@item.itunes_image).to eq 'http://example.com/podcasts/everything/AllAboutEverything.jpg'
69
+ it "should parse the image" do
70
+ expect(@item.itunes_image).to eq "http://example.com/podcasts/everything/AllAboutEverything.jpg"
69
71
  end
70
72
 
71
- it 'should parse the order' do
72
- expect(@item.itunes_order).to eq '12'
73
+ it "should parse the order" do
74
+ expect(@item.itunes_order).to eq "12"
73
75
  end
74
76
 
75
- it 'should parse the closed captioned flag' do
76
- expect(@item.itunes_closed_captioned).to eq 'yes'
77
+ it "should parse the closed captioned flag" do
78
+ expect(@item.itunes_closed_captioned).to eq "yes"
77
79
  end
78
80
 
79
- it 'should parse the encoded content' do
80
- content = '<p><strong>TOPIC</strong>: Gooseneck Options</p>'
81
+ it "should parse the encoded content" do
82
+ content = "<p><strong>TOPIC</strong>: Gooseneck Options</p>"
81
83
  expect(@item.content).to eq content
82
84
  end
83
85
  end
@@ -1,4 +1,6 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
2
4
 
3
5
  describe Feedjira::Parser::ITunesRSSOwner do
4
6
  before(:each) do
@@ -9,11 +11,11 @@ describe Feedjira::Parser::ITunesRSSOwner do
9
11
  @owner = feed.itunes_owners.first
10
12
  end
11
13
 
12
- it 'should parse the name' do
13
- expect(@owner.name).to eq 'John Doe'
14
+ it "should parse the name" do
15
+ expect(@owner.name).to eq "John Doe"
14
16
  end
15
17
 
16
- it 'should parse the email' do
17
- expect(@owner.email).to eq 'john.doe@example.com'
18
+ it "should parse the email" do
19
+ expect(@owner.email).to eq "john.doe@example.com"
18
20
  end
19
21
  end
@@ -1,119 +1,123 @@
1
- require 'spec_helper'
2
-
3
- module Feedjira::Parser
4
- describe '#will_parse?' do
5
- it 'should return true for an itunes RSS feed' do
6
- expect(ITunesRSS).to be_able_to_parse(sample_itunes_feed)
7
- end
8
-
9
- it 'should return true for an itunes RSS feed with spaces between attribute names, equals sign, and values' do # rubocop:disable Metrics/LineLength
10
- expect(ITunesRSS).to be_able_to_parse(sample_itunes_feed_with_spaces)
11
- end
12
-
13
- it 'should return true for an itunes RSS feed with single-quoted attributes' do # rubocop:disable Metrics/LineLength
14
- expect(ITunesRSS).to be_able_to_parse(sample_itunes_feed_with_single_quotes) # rubocop:disable Metrics/LineLength
15
- end
16
-
17
- it 'should return fase for an atom feed' do
18
- expect(ITunesRSS).to_not be_able_to_parse(sample_atom_feed)
19
- end
20
-
21
- it 'should return false for an rss feedburner feed' do
22
- expect(ITunesRSS).to_not be_able_to_parse(sample_rss_feed_burner_feed)
23
- end
24
- end
25
-
26
- describe 'parsing' do
27
- before(:each) do
28
- @feed = ITunesRSS.parse(sample_itunes_feed)
29
- end
30
-
31
- it 'should parse the ttl' do
32
- expect(@feed.ttl).to eq '60'
33
- end
34
-
35
- it 'should parse the last build date' do
36
- expect(@feed.last_built).to eq 'Sat, 07 Sep 2002 09:42:31 GMT'
37
- end
38
-
39
- it 'should parse the subtitle' do
40
- expect(@feed.itunes_subtitle).to eq 'A show about everything'
41
- end
42
-
43
- it 'should parse the author' do
44
- expect(@feed.itunes_author).to eq 'John Doe'
45
- end
46
-
47
- it 'should parse an owner' do
48
- expect(@feed.itunes_owners.size).to eq 1
49
- end
50
-
51
- it 'should parse an image' do
52
- expect(@feed.itunes_image).to eq 'http://example.com/podcasts/everything/AllAboutEverything.jpg'
53
- end
54
-
55
- it 'should parse the image url' do
56
- expect(@feed.image.url).to eq 'http://example.com/podcasts/everything/AllAboutEverything.jpg'
57
- end
58
-
59
- it 'should parse the image title' do
60
- expect(@feed.image.title).to eq 'All About Everything'
61
- end
62
-
63
- it 'should parse the image link' do
64
- expect(@feed.image.link).to eq 'http://www.example.com/podcasts/everything/index.html'
65
- end
66
-
67
- it 'should parse the image width' do
68
- expect(@feed.image.width).to eq '88'
69
- end
70
-
71
- it 'should parse the image height' do
72
- expect(@feed.image.height).to eq '31'
73
- end
74
-
75
- it 'should parse the image description' do
76
- description = 'All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Music Store' # rubocop:disable Metrics/LineLength
77
- expect(@feed.image.description).to eq description
78
- end
79
-
80
- it 'should parse categories' do
81
- expect(@feed.itunes_categories).to eq [
82
- 'Technology',
83
- 'Gadgets',
84
- 'TV & Film',
85
- 'Arts',
86
- 'Design',
87
- 'Food'
88
- ]
89
-
90
- expect(@feed.itunes_category_paths).to eq [
91
- %w(Technology Gadgets),
92
- ['TV & Film'],
93
- %w(Arts Design),
94
- %w(Arts Food)
95
- ]
96
- end
97
-
98
- it 'should parse the itunes type' do
99
- expect(@feed.itunes_type).to eq 'episodic'
100
- end
101
-
102
- it 'should parse the summary' do
103
- summary = 'All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Music Store' # rubocop:disable Metrics/LineLength
104
- expect(@feed.itunes_summary).to eq summary
105
- end
106
-
107
- it 'should parse the complete tag' do
108
- expect(@feed.itunes_complete).to eq 'yes'
109
- end
110
-
111
- it 'should parse entries' do
112
- expect(@feed.entries.size).to eq 3
113
- end
114
-
115
- it 'should parse the new-feed-url' do
116
- expect(@feed.itunes_new_feed_url).to eq 'http://example.com/new.xml'
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ module Feedjira
6
+ module Parser
7
+ describe "#will_parse?" do
8
+ it "should return true for an itunes RSS feed" do
9
+ expect(ITunesRSS).to be_able_to_parse(sample_itunes_feed)
10
+ end
11
+
12
+ it "should return true for an itunes RSS feed with spaces between attribute names, equals sign, and values" do
13
+ expect(ITunesRSS).to be_able_to_parse(sample_itunes_feed_with_spaces)
14
+ end
15
+
16
+ it "should return true for an itunes RSS feed with single-quoted attributes" do
17
+ expect(ITunesRSS).to be_able_to_parse(sample_itunes_feed_with_single_quotes)
18
+ end
19
+
20
+ it "should return fase for an atom feed" do
21
+ expect(ITunesRSS).to_not be_able_to_parse(sample_atom_feed)
22
+ end
23
+
24
+ it "should return false for an rss feedburner feed" do
25
+ expect(ITunesRSS).to_not be_able_to_parse(sample_rss_feed_burner_feed)
26
+ end
27
+ end
28
+
29
+ describe "parsing" do
30
+ before(:each) do
31
+ @feed = ITunesRSS.parse(sample_itunes_feed)
32
+ end
33
+
34
+ it "should parse the ttl" do
35
+ expect(@feed.ttl).to eq "60"
36
+ end
37
+
38
+ it "should parse the last build date" do
39
+ expect(@feed.last_built).to eq "Sat, 07 Sep 2002 09:42:31 GMT"
40
+ end
41
+
42
+ it "should parse the subtitle" do
43
+ expect(@feed.itunes_subtitle).to eq "A show about everything"
44
+ end
45
+
46
+ it "should parse the author" do
47
+ expect(@feed.itunes_author).to eq "John Doe"
48
+ end
49
+
50
+ it "should parse an owner" do
51
+ expect(@feed.itunes_owners.size).to eq 1
52
+ end
53
+
54
+ it "should parse an image" do
55
+ expect(@feed.itunes_image).to eq "http://example.com/podcasts/everything/AllAboutEverything.jpg"
56
+ end
57
+
58
+ it "should parse the image url" do
59
+ expect(@feed.image.url).to eq "http://example.com/podcasts/everything/AllAboutEverything.jpg"
60
+ end
61
+
62
+ it "should parse the image title" do
63
+ expect(@feed.image.title).to eq "All About Everything"
64
+ end
65
+
66
+ it "should parse the image link" do
67
+ expect(@feed.image.link).to eq "http://www.example.com/podcasts/everything/index.html"
68
+ end
69
+
70
+ it "should parse the image width" do
71
+ expect(@feed.image.width).to eq "88"
72
+ end
73
+
74
+ it "should parse the image height" do
75
+ expect(@feed.image.height).to eq "31"
76
+ end
77
+
78
+ it "should parse the image description" do
79
+ description = "All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Music Store"
80
+ expect(@feed.image.description).to eq description
81
+ end
82
+
83
+ it "should parse categories" do
84
+ expect(@feed.itunes_categories).to eq [
85
+ "Technology",
86
+ "Gadgets",
87
+ "TV & Film",
88
+ "Arts",
89
+ "Design",
90
+ "Food"
91
+ ]
92
+
93
+ expect(@feed.itunes_category_paths).to eq [
94
+ %w[Technology Gadgets],
95
+ ["TV & Film"],
96
+ %w[Arts Design],
97
+ %w[Arts Food]
98
+ ]
99
+ end
100
+
101
+ it "should parse the itunes type" do
102
+ expect(@feed.itunes_type).to eq "episodic"
103
+ end
104
+
105
+ it "should parse the summary" do
106
+ summary = "All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Music Store"
107
+ expect(@feed.itunes_summary).to eq summary
108
+ end
109
+
110
+ it "should parse the complete tag" do
111
+ expect(@feed.itunes_complete).to eq "yes"
112
+ end
113
+
114
+ it "should parse entries" do
115
+ expect(@feed.entries.size).to eq 3
116
+ end
117
+
118
+ it "should parse the new-feed-url" do
119
+ expect(@feed.itunes_new_feed_url).to eq "http://example.com/new.xml"
120
+ end
117
121
  end
118
122
  end
119
123
  end