<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>db/migrate/048_default_stories_bucket_to_null.rb</filename>
    </added>
    <added>
      <filename>spec/migrations/048_default_stories_bucket_to_null_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,7 +1,5 @@
-.gitignore
 .DS_Store
 config/database.yml
-db/schema.rb
 log/*
 coverage/*
 nginx.conf</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -81,7 +81,7 @@ class Story &lt; ActiveRecord::Base
   
   def self.find_backlog options = {}
     with_scope :find =&gt; options do
-      find :all, :conditions =&gt; { :bucket_id =&gt; nil }
+      find :all, :conditions =&gt; &quot;bucket_id IS NULL&quot;
     end
   end
 end</diff>
      <filename>app/models/story.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version =&gt; 47) do
+ActiveRecord::Schema.define(:version =&gt; 48) do
 
   create_table &quot;activities&quot;, :force =&gt; true do |t|
     t.integer  &quot;actor_id&quot;</diff>
      <filename>db/schema.rb</filename>
    </modified>
    <modified>
      <diff>@@ -135,4 +135,31 @@ describe Story, &quot;complete&quot; do
     story = Story.new :status =&gt; statuses(:blocked)
     story.should be_incomplete
   end
+end
+
+describe Story, '.find_backlog' do
+=begin  def self.find_backlog options = {}
+    with_scope :find =&gt; options do
+      find :all, :conditions =&gt; &quot;bucket_id IS NULL&quot;
+    end
+  end
+=end
+
+  before do
+    bucket = Generate.bucket
+    @stories_without_a_bucket = Generate.stories :count =&gt; 2, :bucket =&gt; nil
+    @stories_with_a_bucket = Generate.stories :count =&gt; 2, :bucket =&gt; bucket
+  end
+
+  it &quot;finds all stories which don't belong to a bucket&quot; do
+    Story.find_backlog.should == @stories_without_a_bucket
+  end
+  
+  it &quot;uses the passed in find options to help refine the search while still only including stories without a bucket&quot; do
+    @stories_without_a_bucket.first.update_attribute(:description, &quot;BAZ&quot;)
+    Story.find_backlog(
+      :conditions =&gt; &quot;description = 'BAZ'&quot;
+    ).should == [@stories_without_a_bucket.first]
+  end
+
 end
\ No newline at end of file</diff>
      <filename>spec/models/story_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -76,6 +76,14 @@ class Generate
       end
     end
   end
+
+  def self.stories(attributes={})
+    stories = []
+    attributes.delete(:count).times do 
+      stories &lt;&lt; Generate.story(attributes)
+    end
+    stories
+  end
   
   def self.story(attributes={})
     @story_count ||= 0</diff>
      <filename>spec/spec_helpers/model_generation.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d6f9c7e7971f8275fb92a5b53dd46f2348a59463</id>
    </parent>
  </parents>
  <author>
    <name>Zach Dennis</name>
    <email>zach.dennis@gmail.com</email>
  </author>
  <url>http://github.com/zdennis/strac/commit/2124e79c59ce2793c24162a91d829e2e8a7b1bf8</url>
  <id>2124e79c59ce2793c24162a91d829e2e8a7b1bf8</id>
  <committed-date>2008-03-28T18:59:06-07:00</committed-date>
  <authored-date>2008-03-28T18:59:06-07:00</authored-date>
  <message>Added a migration which forces that a story's bucket_id default to nil/null to avoid issues where some mysql setups default integer fields to NULL and others to 0.</message>
  <tree>69b835812e8f67deb7cc74b6c33196c5940e3c56</tree>
  <committer>
    <name>Zach Dennis</name>
    <email>zach.dennis@gmail.com</email>
  </committer>
</commit>
