<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/models/client_testimonial.rb</filename>
    </added>
    <added>
      <filename>app/models/project_testimonial.rb</filename>
    </added>
    <added>
      <filename>app/models/testimonial.rb</filename>
    </added>
    <added>
      <filename>db/migrate/20090423113751_create_testimonials.rb</filename>
    </added>
    <added>
      <filename>spec/models/testimonial_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -3,6 +3,7 @@ class Client &lt; ActiveRecord::Base
   
   has_many :client_texts, :dependent =&gt; :destroy
   has_many :projects, :dependent =&gt; :destroy
+  has_many :testimonials, :through =&gt; :client_testimonials, :dependent =&gt; :destroy
   belongs_to :created_by, :class_name =&gt; 'User'
   belongs_to :updated_by, :class_name =&gt; 'User'
   </diff>
      <filename>app/models/client.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,6 +3,7 @@ class Project &lt; ActiveRecord::Base
   
   belongs_to :client
   has_many :project_texts, :dependent =&gt; :destroy
+  has_many :testimonials, :through =&gt; :project_testimonials
   belongs_to :created_by, :class_name =&gt; 'User'
   belongs_to :updated_by, :class_name =&gt; 'User'
   </diff>
      <filename>app/models/project.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@ module PortfolioTags
 
   class TagError &lt; StandardError; end
   
-  [:clients, :projects].each do |portfolio_model|
+  [:clients, :projects, :testimonials].each do |portfolio_model|
     single_model = portfolio_model.to_s.singularize
     tag &quot;#{portfolio_model.to_s}&quot; do |tag|
       tag.expand
@@ -19,6 +19,9 @@ module PortfolioTags
       end
       result
     end
+  end
+  [:clients, :projects ].each do |portfolio_model|
+    single_model = portfolio_model.to_s.singularize
     tag &quot;#{portfolio_model.to_s}:each:name&quot; do |tag|
       tag.locals.send(&quot;#{single_model}&quot;).send(:name)
     end
@@ -28,6 +31,16 @@ module PortfolioTags
     end
   end
   
+  tag &quot;testimonials:each:author&quot; do |tag|
+    tag.locals.testimonial.author
+  end
+  tag &quot;testimonials:each:author_title&quot; do |tag|
+    tag.locals.testimonial.author_title
+  end
+  tag &quot;testimonials:each:comment&quot; do |tag|
+    tag.locals.testimonial.comment
+  end
+  
   def collection_find_options(tag, model)
     attr = tag.attr.symbolize_keys
     </diff>
      <filename>lib/portfolio_tags.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@ describe Admin::ProjectsController do
 
   #Delete this example and add some real ones
   it &quot;should use ProjectsController&quot; do
-    controller.should be_an_instance_of(ProjectsController)
+    controller.should be_an_instance_of(Admin::ProjectsController)
   end
 
 end</diff>
      <filename>spec/controllers/admin/projects_controller_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,19 +1,24 @@
 class PortfolioDataset &lt; Dataset::Base
-  uses :users
+  uses :pages, :users
   
   def load
     create_client 'Saturn Flyer', 'designers and developers'
     create_client 'Ignite Social Media', 'original' do
+      create_testimonial &quot;They're work is incredible!&quot;, 'Gene Smith'
       create_project 'ignite website', 'moving to Radiant'
     end
     create_client 'Kratos Defense', 'strength to success' do
-      create_project 'iris', 'tracking users and deployments'
+      create_project 'iris', 'tracking users and deployments' do
+        create_testimonial 'We use IRIS more and more every day.', 'Vikram Khemani'
+      end
     end
     create_client 'Smithsonian', 'increase &amp; diffusion of knowledge' do
       create_project 'invertebrates', 'updating website'
     end
     create_client 'Bright Yellow Jacket', 'stand apart' do
-      create_project 'byj site', 'developing website'
+      create_project 'byj site', 'developing website' do
+        create_testimonial 'We are very happy with this project', 'Stephen Oster', 'Founding Partner'
+      end
     end
   end
   
@@ -33,5 +38,18 @@ class PortfolioDataset &lt; Dataset::Base
     unless text.blank?
       create_record :project_text, :name =&gt; 'description', :content =&gt; text, :project_id =&gt; project_id(name.symbolize)
     end
+    if block_given?
+      @project_id = project_id(name.symbolize)
+      yield
+    end
+  end
+  
+  def create_testimonial(comment, author, author_title = nil)
+    create_record :testimonial, author.symbolize, :author =&gt; author, :comment =&gt; comment, :author_title =&gt; author_title
+    if !@project_id.blank?
+      create_record :project_testimonial, :testimonial_id =&gt; testimonial_id(author.symbolize), :project_id =&gt; @project_id
+    elsif !@client_id.blank?
+      create_record :client_testimonial, :testimonial_id =&gt; testimonial_id(author.symbolize), :client_id =&gt; @client_id
+    end
   end
 end
\ No newline at end of file</diff>
      <filename>spec/datasets/portfolio_dataset.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,6 +6,7 @@ describe Client do
   end
 
   it &quot;should have at least 1 client text&quot; do
+    @client.save!
     @client.should have_at_least(1).client_texts
   end
 end</diff>
      <filename>spec/models/client_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 require File.dirname(__FILE__) + '/../spec_helper'
 
 describe Page do
-  dataset :pages, :portfolio
+  dataset :portfolio
 
   describe &quot;clients&quot; do
     it &quot;should expand it's contents&quot; do
@@ -112,4 +112,64 @@ describe Page do
       end
     end
   end
+  
+  describe &quot;testimonials&quot; do
+    it &quot;should expand it's contents&quot; do
+      pages(:home).should render('&lt;r:testimonials&gt;text&lt;/r:testimonials&gt;').as('text')
+    end
+    describe &quot;each&quot; do
+      it &quot;should expand it's contents for each item&quot; do
+        pages(:home).should render('&lt;r:testimonials:each&gt;text &lt;/r:testimonials:each&gt;').as('text text text ')
+      end
+      describe &quot;with limit&quot; do
+        it &quot;should limit the records&quot; do
+          pages(:home).should render('&lt;r:testimonials:each limit=&quot;3&quot;&gt;text &lt;/r:testimonials:each&gt;').as('text text text ')
+        end
+        it &quot;should error with a non-numeric limit&quot; do
+          pages(:home).should render('&lt;r:testimonials:each limit=&quot;abc&quot;&gt;text &lt;/r:testimonials:each&gt;').with_error(&quot;`limit' attribute of `each' tag must be a positive number between 1 and 4 digits&quot;)
+        end
+        it &quot;should offset the records&quot; do
+          pages(:home).should render('&lt;r:testimonials:each limit=&quot;2&quot; offset=&quot;1&quot;&gt;&lt;r:author /&gt; &lt;/r:testimonials:each&gt;').as('Vikram Khemani Stephen Oster ')
+        end
+        it &quot;should error with a non-numeric offset&quot; do
+          pages(:home).should render('&lt;r:testimonials:each limit=&quot;3&quot; offset=&quot;abc&quot;&gt;text &lt;/r:testimonials:each&gt;').with_error(&quot;`offset' attribute of `each' tag must be a positive number between 1 and 4 digits&quot;)
+        end
+      end
+      describe &quot;with ordering&quot; do
+        it &quot;should sort by the given by field&quot; do
+          pages(:home).should render('&lt;r:testimonials:each limit=&quot;3&quot; by=&quot;author&quot;&gt;&lt;r:author /&gt; &lt;/r:testimonials:each&gt;').as('Gene Smith Stephen Oster Vikram Khemani ')
+        end
+        it &quot;should default sort by created_at&quot; do
+          pages(:home).should render('&lt;r:testimonials:each limit=&quot;3&quot;&gt;&lt;r:author /&gt; &lt;/r:testimonials:each&gt;').as('Gene Smith Vikram Khemani Stephen Oster ')
+        end
+        it &quot;should err with an invalid by field&quot; do
+          pages(:home).should render('&lt;r:testimonials:each by=&quot;aoeu&quot;&gt;&lt;r:author /&gt; &lt;/r:testimonials:each&gt;').with_error(&quot;`by' attribute of `each' tag must be set to a valid field name&quot;)
+        end
+        it &quot;should order by the given order field&quot; do
+          pages(:home).should render('&lt;r:testimonials:each limit=&quot;3&quot; by=&quot;author&quot; order=&quot;desc&quot;&gt;&lt;r:author /&gt; &lt;/r:testimonials:each&gt;').as('Vikram Khemani Stephen Oster Gene Smith ')
+        end
+        it &quot;should default order to ascending&quot; do
+          pages(:home).should render('&lt;r:testimonials:each limit=&quot;3&quot; by=&quot;author&quot;&gt;&lt;r:author /&gt; &lt;/r:testimonials:each&gt;').as('Gene Smith Stephen Oster Vikram Khemani ')
+        end
+        it &quot;should err with an invalid order attribute&quot; do
+          pages(:home).should render('&lt;r:testimonials:each order=&quot;123&quot;&gt;&lt;r:author /&gt;&lt;/r:testimonials:each&gt;').with_error(%{`order' attribute of `each' tag must be set to either &quot;asc&quot; or &quot;desc&quot;})
+        end
+      end
+      describe &quot;author&quot; do
+        it &quot;should display the author&quot; do
+          pages(:home).should render('&lt;r:testimonials:each&gt;&lt;r:author /&gt; &lt;/r:testimonials:each&gt;').as('Gene Smith Vikram Khemani Stephen Oster ')
+        end
+      end
+      describe &quot;author_title&quot; do
+        it &quot;should display the author_title&quot; do
+          pages(:home).should render('&lt;r:testimonials:each&gt;&lt;r:author_title /&gt; &lt;/r:testimonials:each&gt;').as('  Founding Partner ')
+        end
+      end
+      describe &quot;content&quot; do
+        it &quot;should display the project comment&quot; do
+          pages(:home).should render('&lt;r:testimonials:each limit=&quot;1&quot;&gt;&lt;r:comment /&gt;&lt;/r:testimonials:each&gt;').as(&quot;They're work is incredible!&quot;)
+        end
+      end
+    end
+  end
 end</diff>
      <filename>spec/models/portfolio_tags_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>abeaa62b6cc0fe3635ed880c42da077454f185cb</id>
    </parent>
  </parents>
  <author>
    <name>Jim Gay</name>
    <email>jim@saturnflyer.com</email>
  </author>
  <url>http://github.com/saturnflyer/radiant-portfolio/commit/8b3073008e7544621ce5e51adde07cbade19dd01</url>
  <id>8b3073008e7544621ce5e51adde07cbade19dd01</id>
  <committed-date>2009-04-28T19:41:06-07:00</committed-date>
  <authored-date>2009-04-28T19:41:06-07:00</authored-date>
  <message>adding testimonials</message>
  <tree>8b8ab88a75c61070d36a761de93ab7242c4abb15</tree>
  <committer>
    <name>Jim Gay</name>
    <email>jim@saturnflyer.com</email>
  </committer>
</commit>
