feedjira 2.2.0 → 3.0.0.beta1

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