<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -24,3 +24,6 @@
       %span= status_diff(version)
   %div{:style =&gt; &quot;clear:both&quot;}
   %p= updated_stamp(version.instance)
+  - form_tag(edit_admin_snippet_path(:id =&gt; version.versionable_id), :method =&gt; :get) do
+    = hidden_field_tag(:version, version.number)
+    = submit_tag(&quot;Revert to Version #{version.number}&quot;, :name =&gt; nil)</diff>
      <filename>app/views/admin/snippets/_diff.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -11,11 +11,25 @@ Feature: revert
     When I view a previous version
     And I click the revert button
     Then I should be taken to the edit page
-    And the older content should be loaded
+    And the older page content should be loaded
     And I should see &quot;Loaded version 1. Click save to revert to this content.&quot;
   
   Scenario: revert page to previous version
     Given I have a page with more than one version
-    When I edit a previous version
+    When I edit a previous page version
     And I press &quot;Save&quot;
-    Then I should see &quot;Your page has been saved&quot;
\ No newline at end of file
+    Then I should see &quot;Your page has been saved&quot;
+  
+  Scenario: load previous snippet version for editing
+    Given I have a snippet with more than one version
+    When I view a previous version
+    And I click the revert button
+    Then I should be taken to the edit page
+    And the older snippet content should be loaded
+    And I should see &quot;Loaded version 1. Click save to revert to this content.&quot;
+  
+  Scenario: revert snippet to previous version
+    Given I have a snippet with more than one version
+    When I edit a previous snippet version
+    And I press &quot;Save&quot;
+    Then I should see &quot;Snippet saved below&quot;
\ No newline at end of file</diff>
      <filename>features/revert.feature</filename>
    </modified>
    <modified>
      <diff>@@ -35,6 +35,14 @@ Given /^I have a page with more than one version$/ do
   @page.save
 end
 
+Given /^I have a snippet with more than one version$/ do
+  @snippet = snippets(:first)
+  @snippet.save # version 1
+  @snippet.status = Status[:published]
+  @snippet.name = @snippet.name += &quot;_version_2&quot;
+  @snippet.save # version 2
+end
+
 When /^I edit the page$/ do
   visit admin_pages_path
   click_link @page.title
@@ -50,17 +58,26 @@ When /^I click the revert button$/ do
   click_button &quot;Revert to Version 1&quot;
 end
 
-When /^I edit a previous version$/ do
+When /^I edit a previous page version$/ do
   visit edit_admin_page_path(:id =&gt; @page.id, :version =&gt; 1)
 end
 
+When /^I edit a previous snippet version$/ do
+  visit edit_admin_snippet_path(:id =&gt; @snippet.id, :version =&gt; 1)
+end
+
 Then /^I should be taken to the edit page$/ do
-  request.params.should == {&quot;format&quot;=&gt;&quot;html&quot;, &quot;action&quot;=&gt;&quot;edit&quot;, &quot;id&quot;=&gt;&quot;520095529&quot;, &quot;version&quot;=&gt;&quot;1&quot;, &quot;controller&quot;=&gt;&quot;admin/pages&quot;}
-  response.should have_selector('h1', :content =&gt; &quot;Edit Page&quot;)
+  request.params[&quot;version&quot;].should == &quot;1&quot;
+  request.params[&quot;action&quot;].should == &quot;edit&quot;
 end
 
-Then /^the older content should be loaded$/ do
-  field_labeled(&quot;Page Title&quot;).value.should_not == @page.current.title
+Then /^the older (.+) content should be loaded$/ do |model|
+  case model
+  when &quot;page&quot;
+    field_labeled(&quot;Page Title&quot;).value.should_not == @page.current.title
+  when &quot;snippet&quot;
+    field_labeled(&quot;Name&quot;).value.should_not == @snippet.current.name
+  end
 end
 
 Then /^the content I am editing should be the draft$/ do</diff>
      <filename>features/step_definitions/versioning_steps.rb</filename>
    </modified>
    <modified>
      <diff>@@ -20,5 +20,5 @@ Cucumber::Rails::World.class_eval do
   datasets_directory &quot;#{RADIANT_ROOT}/spec/datasets&quot;
   self.datasets_database_dump_path = &quot;#{Rails.root}/tmp/dataset&quot;
  
-  dataset :pages_with_layouts, :users
+  dataset :pages_with_layouts, :users, :snippets
 end</diff>
      <filename>features/support/env.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 module Chronicle::SimpleModelExtensions
   def self.included(base)
     base.class_eval do
-      simply_versioned
+      simply_versioned :exclude =&gt; [:lock_version]
       alias_method_chain :update_without_callbacks, :draft_versioning
       alias_method_chain :simply_versioned_create_version, :extra_version_attributes
       include ActiveRecord::Diff</diff>
      <filename>lib/chronicle/simple_model_extensions.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ae1c43550622c7dbd14084db0ffba05b0605d390</id>
    </parent>
  </parents>
  <author>
    <name>Jason Garber</name>
    <email>jg@jasongarber.com</email>
  </author>
  <url>http://github.com/jgarber/radiant-chronicle-extension/commit/d64888f93f00828548e1b413224096193c824c34</url>
  <id>d64888f93f00828548e1b413224096193c824c34</id>
  <committed-date>2009-09-07T13:16:42-07:00</committed-date>
  <authored-date>2009-09-07T13:16:42-07:00</authored-date>
  <message>Add ability to revert snippets.</message>
  <tree>51e5d77c828c0b1b8929a73885cd99ba89324dbf</tree>
  <committer>
    <name>Jason Garber</name>
    <email>jg@jasongarber.com</email>
  </committer>
</commit>
