<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -12,17 +12,19 @@ module Feedra
         has_many :feed_errors
         named_scope :stale, lambda {{ :conditions =&gt; ['stale_at &lt; ? OR stale_at IS NULL', Time.now] }}
         
-        before_create :populate_metadata_from_feed
+        #before_create :populate_metadata_from_feed
         before_validation :normalize_feed_url 
       end
     end
 
     def create_feed_error_from_exception(ex)
-      case ex
-      when Fixnum, nil
-        self.feed_errors.create :error_type =&gt; ex.class.to_s, :message =&gt; ex.to_s
-      else
-        self.feed_errors.create :error_type =&gt; ex.class.to_s, :message =&gt; ex.message, :trace =&gt; ex.backtrace
+      self.feed_errors.create_from_feedzirra_error(ex)
+    end
+
+    def create_entries_from_feedzirra_entries(feedzirra_entries)
+      feedzirra_entries.each do |entry|
+        entry_attributes = build_entry_attributes(entry.attributes)
+        entries.create!(entry_attributes) unless entries.find_by_feedzirra_entry(entry)
       end
     end
 
@@ -57,16 +59,16 @@ module Feedra
         else
           feedzirra_feed.sanitize_entries!
 
-          feedzirra_feed.entries.each do |entry|
-            entry_attributes = build_entry_attributes(entry.attributes)
-            entries.create!(entry_attributes) unless entries.find_by_checksum(entry.checksum)
-          end
+          create_entries_from_feedzirra_entries(feedzirra_feed.entries)
         end
+      rescue NoMethodError
+        raise
       rescue Exception =&gt; ex
         create_feed_error_from_exception(ex)
       end
     end
 
+    # hook, in case you need to add anything extra
     def build_entry_attributes(attributes)
       attributes
     end</diff>
      <filename>lib/feedra/feed.rb</filename>
    </modified>
    <modified>
      <diff>@@ -32,4 +32,53 @@ describe Feed do
     end
   end
 
+  describe &quot;fetch!&quot; do
+    it &quot;should create a feed error if feedzirra returns a number&quot; do
+      feed = Feed.new(:feed_url =&gt; 'http://example.com/atom')
+
+      stub(Feedzirra::Feed).fetch_and_parse('http://example.com/atom') { 404 }
+
+      mock(feed).create_feed_error_from_exception(404)
+
+      feed.fetch!
+    end
+
+    it &quot;should create a feed error if feedzirra returns nil&quot; do
+      feed = Feed.new(:feed_url =&gt; 'http://example.com/atom')
+
+      stub(Feedzirra::Feed).fetch_and_parse('http://example.com/atom') { nil }
+
+      mock(feed).create_feed_error_from_exception(nil)
+
+      feed.fetch!
+    end
+
+    it &quot;should create a feed error if feedzirra raises an error&quot; do
+      feed = Feed.new(:feed_url =&gt; 'http://example.com/atom')
+
+      error = RuntimeError.new(&quot;zomg&quot;)
+      stub(Feedzirra::Feed).fetch_and_parse('http://example.com/atom') { raise error }
+
+      mock(feed).create_feed_error_from_exception(error)
+
+      feed.fetch!
+    end
+
+    it &quot;should create entries from feedzirra entries&quot; do
+      feed = Feed.new(:feed_url =&gt; 'http://example.com/atom')
+
+      feedzirra_feed = &quot;fake feed&quot;
+      feedzirra_entries = &quot;fake entries&quot;
+      stub(feedzirra_feed).entries { feedzirra_entries }
+
+      stub(Feedzirra::Feed).fetch_and_parse('http://example.com/atom') { feedzirra_feed }
+
+      mock(feedzirra_feed).sanitize_entries!
+
+      mock(feed).create_entries_from_feedzirra_entries(feedzirra_entries)
+
+      feed.fetch!
+    end
+  end
+
 end</diff>
      <filename>spec/feed_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7f4480619b1c0aa26321bb459074a925338e79e2</id>
    </parent>
  </parents>
  <author>
    <name>Josh Nichols</name>
    <email>josh@technicalpickles.com</email>
  </author>
  <url>http://github.com/technicalpickles/feedra/commit/4920798ee4e90ea1fd851009dca6316bae5f6e16</url>
  <id>4920798ee4e90ea1fd851009dca6316bae5f6e16</id>
  <committed-date>2009-07-28T22:10:15-07:00</committed-date>
  <authored-date>2009-07-28T22:10:15-07:00</authored-date>
  <message>More feed specs.</message>
  <tree>56ec0eb618d89d9263968ff7d54a1bb048094268</tree>
  <committer>
    <name>Josh Nichols</name>
    <email>josh@technicalpickles.com</email>
  </committer>
</commit>
