maxlapshin-feedzirra 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,41 @@
1
+ require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
2
+
3
+ describe Feedzirra::Parser::RSSEntry do
4
+ before(:each) do
5
+ # I don't really like doing it this way because these unit test should only rely on RSSEntry,
6
+ # but this is actually how it should work. You would never just pass entry xml straight to the AtomEnry
7
+ @entry = Feedzirra::Parser::RSS.parse(sample_rss_feed).entries.first
8
+ end
9
+
10
+ it "should parse the title" do
11
+ @entry.title.should == "Nokogiri’s Slop Feature"
12
+ end
13
+
14
+ it "should parse the url" do
15
+ @entry.url.should == "http://tenderlovemaking.com/2008/12/04/nokogiris-slop-feature/"
16
+ end
17
+
18
+ it "should parse the author" do
19
+ @entry.author.should == "Aaron Patterson"
20
+ end
21
+
22
+ it "should parse the content" do
23
+ @entry.content.should == sample_rss_entry_content
24
+ end
25
+
26
+ it "should provide a summary" do
27
+ @entry.summary.should == "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  [...]"
28
+ end
29
+
30
+ it "should parse the published date" do
31
+ @entry.published.to_s.should == "Thu Dec 04 17:17:49 UTC 2008"
32
+ end
33
+
34
+ it "should parse the categories" do
35
+ @entry.categories.should == ['computadora', 'nokogiri', 'rails']
36
+ end
37
+
38
+ it "should parse the guid as id" do
39
+ @entry.id.should == "http://tenderlovemaking.com/?p=198"
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
2
+
3
+ describe Feedzirra::Parser::RSS do
4
+ describe "#will_parse?" do
5
+ it "should return true for an RSS feed" do
6
+ Feedzirra::Parser::RSS.should be_able_to_parse(sample_rss_feed)
7
+ end
8
+
9
+ # this is no longer true. combined rdf and rss into one
10
+ # it "should return false for an rdf feed" do
11
+ # Feedzirra::RSS.should_not be_able_to_parse(sample_rdf_feed)
12
+ # end
13
+
14
+ it "should return fase for an atom feed" do
15
+ Feedzirra::Parser::RSS.should_not be_able_to_parse(sample_atom_feed)
16
+ end
17
+ end
18
+
19
+ describe "parsing" do
20
+ before(:each) do
21
+ @feed = Feedzirra::Parser::RSS.parse(sample_rss_feed)
22
+ end
23
+
24
+ it "should parse the title" do
25
+ @feed.title.should == "Tender Lovemaking"
26
+ end
27
+
28
+ it "should parse the url" do
29
+ @feed.url.should == "http://tenderlovemaking.com"
30
+ end
31
+
32
+ it "should provide an accessor for the feed_url" do
33
+ @feed.respond_to?(:feed_url).should == true
34
+ @feed.respond_to?(:feed_url=).should == true
35
+ end
36
+
37
+ it "should parse entries" do
38
+ @feed.entries.size.should == 10
39
+ end
40
+ end
41
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,2 @@
1
+ --diff
2
+ --color
@@ -0,0 +1,58 @@
1
+ require "rubygems"
2
+ require "spec"
3
+
4
+ # gem install redgreen for colored test output
5
+ begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end
6
+
7
+ path = File.expand_path(File.dirname(__FILE__) + "/../lib/")
8
+ $LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path)
9
+
10
+ require "lib/feedzirra"
11
+
12
+ def load_sample(filename)
13
+ File.read("#{File.dirname(__FILE__)}/sample_feeds/#{filename}")
14
+ end
15
+
16
+ def sample_atom_feed
17
+ load_sample("AmazonWebServicesBlog.xml")
18
+ end
19
+
20
+ def sample_atom_entry_content
21
+ load_sample("AmazonWebServicesBlogFirstEntryContent.xml")
22
+ end
23
+
24
+ def sample_itunes_feed
25
+ load_sample("itunes.xml")
26
+ end
27
+
28
+ def sample_rdf_feed
29
+ load_sample("HREFConsideredHarmful.xml")
30
+ end
31
+
32
+ def sample_rdf_entry_content
33
+ load_sample("HREFConsideredHarmfulFirstEntry.xml")
34
+ end
35
+
36
+ def sample_rss_feed_burner_feed
37
+ load_sample("SamHarrisAuthorPhilosopherEssayistAtheist.xml")
38
+ end
39
+
40
+ def sample_rss_feed
41
+ load_sample("TenderLovemaking.xml")
42
+ end
43
+
44
+ def sample_rss_entry_content
45
+ load_sample("TenderLovemakingFirstEntry.xml")
46
+ end
47
+
48
+ def sample_feedburner_atom_feed
49
+ load_sample("PaulDixExplainsNothing.xml")
50
+ end
51
+
52
+ def sample_feedburner_atom_entry_content
53
+ load_sample("PaulDixExplainsNothingFirstEntryContent.xml")
54
+ end
55
+
56
+ def sample_wfw_feed
57
+ load_sample("PaulDixExplainsNothingWFW.xml")
58
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: maxlapshin-feedzirra
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.16
5
+ platform: ruby
6
+ authors:
7
+ - Paul Dix
8
+ - Max Lapshin
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2009-02-19 00:00:00 -08:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: nokogiri
18
+ type: :runtime
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">"
23
+ - !ruby/object:Gem::Version
24
+ version: 0.0.0
25
+ version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: pauldix-sax-machine
28
+ type: :runtime
29
+ version_requirement:
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 0.0.12
35
+ version:
36
+ - !ruby/object:Gem::Dependency
37
+ name: eventmachine
38
+ type: :runtime
39
+ version_requirement:
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 0.12.9
45
+ version:
46
+ - !ruby/object:Gem::Dependency
47
+ name: igrigorik-em-http-request
48
+ type: :runtime
49
+ version_requirement:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.7
55
+ version:
56
+ - !ruby/object:Gem::Dependency
57
+ name: builder
58
+ type: :runtime
59
+ version_requirement:
60
+ version_requirements: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 2.1.2
65
+ version:
66
+ - !ruby/object:Gem::Dependency
67
+ name: activesupport
68
+ type: :runtime
69
+ version_requirement:
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 2.0.0
75
+ version:
76
+ - !ruby/object:Gem::Dependency
77
+ name: mdalessio-dryopteris
78
+ type: :runtime
79
+ version_requirement:
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 0.0.0
85
+ version:
86
+ description:
87
+ email: paul@pauldix.net
88
+ executables: []
89
+
90
+ extensions: []
91
+
92
+ extra_rdoc_files: []
93
+
94
+ files:
95
+ - lib/core_ext/date.rb
96
+ - lib/core_ext/string.rb
97
+ - lib/feedzirra.rb
98
+ - lib/feedzirra/feed.rb
99
+ - lib/feedzirra/parser/atom.rb
100
+ - lib/feedzirra/parser/atom_entry.rb
101
+ - lib/feedzirra/parser/atom_feed_burner.rb
102
+ - lib/feedzirra/parser/atom_feed_burner_entry.rb
103
+ - lib/feedzirra/parser/itunes_rss.rb
104
+ - lib/feedzirra/parser/itunes_rss_item.rb
105
+ - lib/feedzirra/parser/itunes_rss_owner.rb
106
+ - lib/feedzirra/parser/rss.rb
107
+ - lib/feedzirra/parser/rss_entry.rb
108
+ - lib/feedzirra/feed_utilities.rb
109
+ - lib/feedzirra/feed_entry_utilities.rb
110
+ - README.textile
111
+ - Rakefile
112
+ - spec/spec.opts
113
+ - spec/spec_helper.rb
114
+ - spec/feedzirra/feed_spec.rb
115
+ - spec/feedzirra/parser/atom_spec.rb
116
+ - spec/feedzirra/parser/atom_entry_spec.rb
117
+ - spec/feedzirra/parser/atom_feed_burner_spec.rb
118
+ - spec/feedzirra/parser/atom_feed_burner_entry_spec.rb
119
+ - spec/feedzirra/parser/itunes_rss_spec.rb
120
+ - spec/feedzirra/parser/itunes_rss_item_spec.rb
121
+ - spec/feedzirra/parser/itunes_rss_owner_spec.rb
122
+ - spec/feedzirra/parser/rss_spec.rb
123
+ - spec/feedzirra/parser/rss_entry_spec.rb
124
+ - spec/feedzirra/feed_utilities_spec.rb
125
+ - spec/feedzirra/feed_entry_utilities_spec.rb
126
+ has_rdoc: true
127
+ homepage: http://github.com/maxlapshin/feedzirra
128
+ licenses:
129
+ post_install_message:
130
+ rdoc_options: []
131
+
132
+ require_paths:
133
+ - lib
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: "0"
139
+ version:
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: "0"
145
+ version:
146
+ requirements: []
147
+
148
+ rubyforge_project:
149
+ rubygems_version: 1.3.5
150
+ signing_key:
151
+ specification_version: 2
152
+ summary: "A feed fetching and parsing library that treats the internet like Godzilla treats Japan: it dominates and eats all."
153
+ test_files: []
154
+