<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>spec/spec_helpers/app_specific.rb</filename>
    </added>
    <added>
      <filename>spec/spec_helpers/app_specific/article_spec_helper.rb</filename>
    </added>
    <added>
      <filename>spec/spec_helpers/core.rb</filename>
    </added>
    <added>
      <filename>spec/spec_helpers/core/default_controller_helper.rb</filename>
    </added>
    <added>
      <filename>spec/spec_helpers/core/default_model_helper.rb</filename>
    </added>
    <added>
      <filename>spec/spec_helpers/core/default_spec_helper.rb</filename>
    </added>
    <added>
      <filename>spec/spec_helpers/shared_behaviors.rb</filename>
    </added>
    <added>
      <filename>spec/spec_helpers/shared_behaviors/default_controller_behavior.rb</filename>
    </added>
    <added>
      <filename>spec/spec_helpers/shared_behaviors/required_fields.rb</filename>
    </added>
    <added>
      <filename>spec/spec_helpers/shared_behaviors/timestamps.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,13 +1,56 @@
 class Articles &lt; Application
+  provides :xml, :js, :yaml
   
   def index
     @articles = Article.all
-    render
+    render @articles
+  end
+  
+  def show(id)
+    @article = Article.find(id)
+    raise NotFound unless @article
+    render @article
+  end
+  
+  def new
+    only_provides :html
+    @article = Article.new
+    render @article
+  end
+  
+  def create(article)
+    @article = Article.new(article)
+    if @article.save
+      redirect url(:article, @article)
+    else
+      render :action =&gt; :new
+    end
   end
-
-  def show
-    @article = Article.find params[:id]
+  
+  def edit(id)
+    only_provides :html
+    @article = Article.find(id)
+    raise NotFound unless @article
     render
   end
-
+  
+  def update(id, article)
+    @article = Article.find(id)
+    raise NotFound unless @article
+    if @article.update_attributes(article)
+      redirect url(:article, @article)
+    else
+      raise BadRequest
+    end
+  end
+  
+  def destroy(id)
+    @article = Article.find(id)
+    raise NotFound unless @article
+    if @article.destroy!
+      redirect url(:articles)
+    else
+      raise BadRequest
+    end
+  end
 end
\ No newline at end of file</diff>
      <filename>app/controllers/articles.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,10 +8,13 @@ class Article &lt; DataMapper::Base
 
   has_many :comments
   
-  before_save :set_slug
+  validates_presence_of :title
+  validates_presence_of :slug
   
-  def set_slug(slug = self.title)
-    self.slug = slug.gsub(&quot; &quot;, &quot;_&quot;)
+  before_validation :set_slug
+  
+  def set_slug(slug_title = self.title)
+    self.slug = slug_title.gsub(&quot; &quot;, &quot;_&quot;) if slug_title
   end
   
 end</diff>
      <filename>app/models/article.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,45 +1,9 @@
 require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb')
 
-describe &quot;Articles Controller&quot;, &quot;index action&quot; do
-  before(:each) do
-    @article1 = mock(&quot;article&quot;)
-    @article2 = mock(&quot;article&quot;)
-    @articles = [@article1, @article2]
-    Article.should_receive(:all).and_return(@articles)
-    @controller = Articles.build(fake_request)
-    @controller.stub!(:render)
-    @controller.dispatch('index')
-  end
-  
-  it &quot;should get successfully&quot; do
-    @controller.status.should == 200
-  end
-  
-  it &quot;should assign all articles&quot; do
-    @controller.instance_variable_get(&quot;@articles&quot;).should == @articles
-  end
-end
-
-describe &quot;Articles Controller&quot;, &quot;show action&quot; do
-  before(:each) do 
-    @article = mock(&quot;@article&quot;)
-    @article.stub!(:id).and_return(1)
-    Article.stub!(:find_by_id).and_return(@article)
-  end
-  
-  it &quot;should return only one article&quot; do 
-    Article.should_receive(:find).with('1').and_return(@article)
-    request(:get, '/articles/1', :yields =&gt; controller)
-  end
-  
-  it &quot;should only return comments associated with this article&quot;
-  
-end
+describe Articles do
+  include DefaultSpecHelper
+  include DefaultControllerHelper
+  include ArticleSpecHelper
 
-describe &quot;Articles Controller&quot;, &quot;destroy action&quot; do
-  
-  it &quot;should only delete one article&quot;
-  it &quot;should delete all comments owned by the deleted article&quot;
-  
+  it_should_behave_like &quot;default controller behavior&quot;
 end
-</diff>
      <filename>spec/controllers/articles_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,24 +1,18 @@
 require File.join( File.dirname(__FILE__), &quot;..&quot;, &quot;spec_helper&quot; )
 
 describe Article do
-  before(:each) do 
-    @article = Article.new
-  end
-  
-  it &quot;should have a title&quot; do 
-    @article.title = &quot;First article!&quot;
-    @article.title.should == &quot;First article!&quot;
-  end
-  
-  it &quot;should have a body&quot; do 
-    @article.body = &quot;The body of the article&quot;
-    @article.body.should == &quot;The body of the article&quot;
-  end
+  include DefaultSpecHelper
+  include DefaultModelHelper
+  include ArticleSpecHelper
+
+  it_should_behave_like &quot;timestamps work correctly&quot;
+  it_should_behave_like &quot;validates required fields&quot;
   
   it &quot;should build a slug&quot; do
-    @article.title = &quot;Page One&quot;
-    @article.save
-    @article.slug.should == &quot;Page_One&quot;
+    article = Article.new(:title =&gt; &quot;Page One&quot;)
+    article.save
+    article.should_not be_nil
+    article.slug.should == &quot;Page_One&quot;
   end
   
 end
\ No newline at end of file</diff>
      <filename>spec/models/article_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,17 @@
+dir = File.dirname(__FILE__)
 $TESTING=true
-require File.join(File.dirname(__FILE__), &quot;..&quot;, 'config', 'boot')
+require File.join(dir, &quot;..&quot;, 'config', 'boot')
 Merb.environment=&quot;test&quot;
 require File.join(Merb.root, 'config', 'merb_init')
 
 require 'merb/test/helper'
 require 'merb/test/rspec'
 
+require &quot;#{dir}/spec_helpers/core&quot;
+require &quot;#{dir}/spec_helpers/custom_matchers&quot;
+require &quot;#{dir}/spec_helpers/shared_behaviors&quot;
+require &quot;#{dir}/spec_helpers/app_specific&quot;
+
 Spec::Runner.configure do |config|
     config.include(Merb::Test::Helper)
     config.include(Merb::Test::RspecMatchers)</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>spec/spec_helpers/shared_behaviours.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>d25bbb297e0d0b94095f85b6492dd3f2f9e9666b</id>
    </parent>
  </parents>
  <author>
    <name>Jeff Whitmire</name>
    <email>jeff@jwhitmire.com</email>
  </author>
  <url>http://github.com/hornbeck/blerb-core/commit/ef6f08553d511bd3cc9108ae043c9fba35cc2aa6</url>
  <id>ef6f08553d511bd3cc9108ae043c9fba35cc2aa6</id>
  <committed-date>2008-01-28T09:00:10-08:00</committed-date>
  <authored-date>2008-01-28T09:00:10-08:00</authored-date>
  <message>implemented default model/controller behaviors; refactored spec_helpers directory</message>
  <tree>fbc2067ec5e94b72d88f3f71bccaef3cf1cf4847</tree>
  <committer>
    <name>Jeff Whitmire</name>
    <email>jeff@jwhitmire.com</email>
  </committer>
</commit>
