Permalink
Browse files

Specs for custom Google Docs parser type, too!

  • Loading branch information...
1 parent a2014bb commit 2242897672e4594a1c0b50becc08d54f1666e4cf @bradhe bradhe committed Feb 29, 2012
@@ -17,6 +17,9 @@ class GoogleDocsAtomEntry
element :modified, :as => :updated
elements :category, :as => :categories, :value => :term
elements :link, :as => :links, :value => :href
+ element :"docs:md5Checksum", :as => :checksum
+ element :"docs:filename", :as => :original_filename
+ element :"docs:suggestedFilename", :as => :suggested_filename
def url
@url ||= links.first
@@ -0,0 +1,22 @@
+require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
+
+describe Feedzirra::Parser::GoogleDocsAtomEntry do
+ describe 'parsing' do
+ before do
+ @feed = Feedzirra::Parser::GoogleDocsAtom.parse(sample_google_docs_list_feed)
+ @entry = @feed.entries.first
+ end
+
+ it 'should have the custom checksum element' do
+ @entry.checksum.should eql '2b01142f7481c7b056c4b410d28f33cf'
+ end
+
+ it 'should have the custom filename element' do
+ @entry.original_filename.should eql "MyFile.pdf"
+ end
+
+ it 'should have the custom suggested filename element' do
+ @entry.suggested_filename.should eql "TaxDocument.pdf"
+ end
+ end
+end
@@ -11,13 +11,21 @@
end
end
- describe '#entries' do
+ describe 'parsing' do
before do
@feed = Feedzirra::Parser::GoogleDocsAtom.parse(sample_google_docs_list_feed)
end
it 'should return a bunch of objects' do
@feed.entries.should_not be_empty
end
+
+ it 'should populate a title, interhited from the Atom entry' do
+ @feed.title.should_not be_nil
+ end
+
+ it 'should return a bunch of entries of type GoogleDocsAtomEntry' do
+ @feed.entries.first.should be_a Feedzirra::Parser::GoogleDocsAtomEntry
+ end
end
end
@@ -183,7 +183,5 @@
href="https://docs.google.com/feeds/default/private/full/pdf%3A12345/acl"/>
<gd:feedLink rel="http://schemas.google.com/docs/2007/revisions"
href="https://docs.google.com/feeds/default/private/full/document%3A12345/revisions"/>
-
-
</entry>
</feed>

0 comments on commit 2242897

Please sign in to comment.