<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/.svn/entries</filename>
    </added>
    <added>
      <filename>lib/.svn/format</filename>
    </added>
    <added>
      <filename>lib/.svn/text-base/acts_as_checkpoint.rb.svn-base</filename>
    </added>
    <added>
      <filename>tasks/.svn/entries</filename>
    </added>
    <added>
      <filename>tasks/.svn/format</filename>
    </added>
    <added>
      <filename>tasks/.svn/text-base/acts_as_checkpoint_tasks.rake.svn-base</filename>
    </added>
    <added>
      <filename>test/.svn/entries</filename>
    </added>
    <added>
      <filename>test/.svn/format</filename>
    </added>
    <added>
      <filename>test/.svn/text-base/acts_as_checkpoint_test.rb.svn-base</filename>
    </added>
    <added>
      <filename>test/database.yml</filename>
    </added>
    <added>
      <filename>test/fixtures/projects.yml</filename>
    </added>
    <added>
      <filename>test/fixtures/roles.yml</filename>
    </added>
    <added>
      <filename>test/fixtures/users.yml</filename>
    </added>
    <added>
      <filename>test/models/project.rb</filename>
    </added>
    <added>
      <filename>test/models/role.rb</filename>
    </added>
    <added>
      <filename>test/models/user.rb</filename>
    </added>
    <added>
      <filename>test/schema.rb</filename>
    </added>
    <added>
      <filename>test/test_helper.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -8,56 +8,56 @@ Example for Controllers
 
 Role-oriented approach:
 
-class YourController &lt; ApplicationController
-	acts_as_checkpoint :get_user_method =&gt; :current_user
-	controller_allows :administrator, :to =&gt; [ :index, :show, :destroy ]
-	controller_allows :registered_user, :to =&gt; [ :index, :show, :new, :edit, :create, :update ]
-	controller_allows :anonymous_user, :to =&gt; [ :index, :show ]
-end
+  class YourController &lt; ApplicationController
+  	acts_as_checkpoint :get_user_method =&gt; :current_user
+  	controller_allows :administrator, :to =&gt; [ :index, :show, :destroy ]
+  	controller_allows :registered_user, :to =&gt; [ :index, :show, :new, :edit, :create, :update ]
+  	controller_allows :anonymous_user, :to =&gt; [ :index, :show ]
+  end
 
 Action-oriented approach:
 
-class YourController &lt; ApplicationController
-	acts_as_checkpoint :get_user_method =&gt; :current_user
-	controller_allows :index  , :by =&gt; [ :administrator, :registered_user, :anonymous_user ]
-	controller_allows :show   , :by =&gt; [ :administrator, :registered_user ]
-	controller_allows :new    , :by =&gt; :registered_user
-	controller_allows :edit   , :by =&gt; :registered_user
-	controller_allows :create , :by =&gt; :registered_user
-	controller_allows :update , :by =&gt; :registered_user
-	controller_allows :destroy, :by =&gt; :administrator
-end
+  class YourController &lt; ApplicationController
+  	acts_as_checkpoint :get_user_method =&gt; :current_user
+  	controller_allows :index  , :by =&gt; [ :administrator, :registered_user, :anonymous_user ]
+  	controller_allows :show   , :by =&gt; [ :administrator, :registered_user ]
+  	controller_allows :new    , :by =&gt; :registered_user
+  	controller_allows :edit   , :by =&gt; :registered_user
+  	controller_allows :create , :by =&gt; :registered_user
+  	controller_allows :update , :by =&gt; :registered_user
+  	controller_allows :destroy, :by =&gt; :administrator
+  end
 
 The two approaches may be interspersed at will... just try not to get confused.
 
 Example for Models
 ==================
 
-class Dog &lt; ActiveRecord::Base
-	belongs_to :owner
+  class Dog &lt; ActiveRecord::Base
+  	belongs_to :owner
 
-	acts_as_checkpoint
-	model_may :eat, :drink, :lick
-	model_allows :lick, :by =&gt; :self
-	model_allows :pet, :by =&gt; :owner
-end
+  	acts_as_checkpoint
+  	model_may :eat, :drink, :lick
+  	model_allows :lick, :by =&gt; :self
+  	model_allows :pet, :by =&gt; :owner
+  end
 
-class Human &lt; ActiveRecord::Base
-	has_many :dogs
+  class Human &lt; ActiveRecord::Base
+  	has_many :dogs
 
-	acts_as_checkpoint
-	model_may :pet
-	model_allows :lick, :by =&gt; :dogs
-end
+  	acts_as_checkpoint
+  	model_may :pet
+  	model_allows :lick, :by =&gt; :dogs
+  end
 
-human = Human.new
-dog = Dog.new( :owner =&gt; human )
+  human = Human.new
+  dog = Dog.new( :owner =&gt; human )
 
-human.can_pet?( dog )
-# =&gt; true
-dog.can_eat?( human )
-# =&gt; false
-dog.can_lick?( human )
-# =&gt; true
+  human.can_pet?( dog )
+  # =&gt; true
+  dog.can_eat?( human )
+  # =&gt; false
+  dog.can_lick?( human )
+  # =&gt; true
 
 Copyright (c) 2008 Brian Langenfeld, released under the MIT license</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -1,8 +1,151 @@
-require 'test/unit'
+require &quot;#{File.dirname(__FILE__)}/test_helper&quot;
+
+include Knotfield::Acts::Checkpoint::Model
 
 class ActsAsCheckpointTest &lt; Test::Unit::TestCase
-  # Replace this with your real tests.
-  def test_this_plugin
-    flunk
+  
+  def setup
+    @admin      = Role.create( :name =&gt; 'Administrator' )
+    @superuser  = Role.create( :name =&gt; 'Superuser' )
+    @user       = Role.create( :name =&gt; 'Registered User' )
+    @guest      = Role.create( :name =&gt; 'Guest' )
+    
+    @housework  = Project.create( :name =&gt; 'Housework' )
+    @yardwork   = Project.create( :name =&gt; 'Yardwork' )
+    
+    @aaron      = User.create(
+      :name     =&gt; 'Aaron the Admin',
+      :roles    =&gt; [ @user, @superuser, @admin ]
+    )
+    @steve      = User.create(
+      :name     =&gt; 'Steve the Superuser',
+      :roles    =&gt; [ @user, @superuser ],
+      :projects_owned   =&gt; [ @housework ],
+      :projects_joined  =&gt; [ @housework ]
+    )
+    @umberto    = User.create(
+      :name     =&gt; 'Umberto the User',
+      :roles    =&gt; [ @user ],
+      :projects_owned   =&gt; [ @yardwork ],
+      :projects_joined  =&gt; [ @yardwork, @housework ]
+    )
+    @gary       = User.create(
+      :name     =&gt; 'Gary',
+      :roles    =&gt; [ @guest ],
+      :projects_joined  =&gt; [ @yardwork ]
+    )
+  end
+  
+  # Make sure all of our test data is set up properly.
+  def test_data
+    assert_not_nil Project.first, &quot;Projects not loaded&quot;
+    assert_not_nil Role.first, &quot;Roles not loaded&quot;
+    assert_not_nil User.first, &quot;Users not loaded&quot;
+    
+    assert_equal true , @aaron.admin?
+    assert_equal true , @aaron.superuser?
+    assert_equal true , @aaron.user?
+    assert_equal false, @aaron.guest?
+    
+    assert_equal false, @steve.admin?
+    assert_equal true , @steve.superuser?
+    assert_equal true , @steve.user?
+    assert_equal false, @steve.guest?
+    
+    assert_equal false, @umberto.admin?
+    assert_equal false, @umberto.superuser?
+    assert_equal true , @umberto.user?
+    assert_equal false, @umberto.guest?
+    
+    assert_equal false, @gary.admin?
+    assert_equal false, @gary.superuser?
+    assert_equal false, @gary.user?
+    assert_equal true , @gary.guest?
+    
+    assert_equal 1, @admin.users.length
+    assert_equal 2, @superuser.users.length
+    assert_equal 3, @user.users.length
+    assert_equal 1, @guest.users.length
+    
+    assert_equal 0, @aaron.projects_owned.length
+    assert_equal 1, @steve.projects_owned.length
+    assert_equal 1, @umberto.projects_owned.length
+    assert_equal 0, @gary.projects_owned.length
+    
+    assert_equal 0, @aaron.projects_joined.length
+    assert_equal 1, @steve.projects_joined.length
+    assert_equal 2, @umberto.projects_joined.length
+    assert_equal 1, @gary.projects_joined.length
+    
+    assert_equal @steve, @housework.owner
+    assert_equal @umberto, @yardwork.owner
+    
+    assert_equal 2, @housework.helpers.count
+    assert @housework.helpers.include?( @steve )
+    assert @housework.helpers.include?( @umberto )
+    assert_equal 2, @yardwork.helpers.length
+    assert @yardwork.helpers.include?( @umberto )
+    assert @yardwork.helpers.include?( @gary )
+  end
+
+  # These tests all deal with role-based permission checks.
+  def test_role_based_checkpoint_model_methods
+    # Aaron should be able to do anything but destroy himself.
+    assert_equal true, @aaron.can_view?( @aaron )
+    assert_equal true, @aaron.can_edit?( @aaron )
+    assert_equal false, @aaron.can_destroy?( @aaron )
+    
+    # Aaron should be able to do anything he wants to anyone else.
+    assert_equal true, @aaron.can_view?( @steve )
+    assert_equal true, @aaron.can_edit?( @steve )
+    assert_equal true, @aaron.can_destroy?( @steve )
+    
+    # Steve should be able to do anything but destroy himself. 
+    assert_equal true, @steve.can_view?( @steve )
+    assert_equal true, @steve.can_edit?( @steve )
+    assert_equal false, @steve.can_destroy?( @steve )
+    
+    # Steve can only view Aaron, because Aaron outranks him.
+    assert_equal true, @steve.can_view?( @aaron )
+    assert_equal false, @steve.can_edit?( @aaron )
+    assert_equal false, @steve.can_destroy?( @aaron )
+    
+    # Steve can view or edit anyone else, though.
+    assert_equal true, @steve.can_view?( @umberto )
+    assert_equal true, @steve.can_edit?( @umberto )
+    assert_equal false, @steve.can_destroy?( @umberto )
+    
+    # Umberto should be able to do anything but destroy himself.
+    assert_equal true, @umberto.can_view?( @umberto )
+    assert_equal true, @umberto.can_edit?( @umberto )
+    assert_equal false, @umberto.can_destroy?( @umberto )
+    
+    # Umberto is playing with fire here...
+    assert_equal true, @umberto.can_view?( @aaron )
+    assert_equal false, @umberto.can_edit?( @aaron )
+    assert_equal false, @umberto.can_destroy?( @aaron )
+    
+    # Umberto outranks Gary, but lacks superuser or admin.
+    assert_equal true, @umberto.can_view?( @gary )
+    assert_equal false, @umberto.can_edit?( @gary )
+    assert_equal false, @umberto.can_destroy?( @gary )
+  end
+  
+  # These tests all deal with association-based permission checks.
+  def test_association_based_checkpoint_model_methods
+    # Steve is the owner of the housework project.
+    assert_equal true, @steve.can_view?( @housework )
+    assert_equal true, @steve.can_edit?( @housework )
+    assert_equal true, @steve.can_destroy?( @housework )
+    
+    # Gary is one of the Yardwork project's helpers, but does not own it.
+    assert_equal true, @gary.can_view?( @yardwork )
+    assert_equal false, @gary.can_edit?( @yardwork )
+    assert_equal false, @gary.can_destroy?( @yardwork )
+    
+    # Steve neither owns nor helps on the Yardwork project.
+    assert_equal false, @steve.can_view?( @yardwork )
+    assert_equal false, @steve.can_edit?( @yardwork )
+    assert_equal false, @steve.can_destroy?( @yardwork )
   end
 end</diff>
      <filename>test/acts_as_checkpoint_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>cc6a589f10b359db835969b4602b143e3ccfe148</id>
    </parent>
  </parents>
  <author>
    <name>Brian Langenfeld</name>
    <email>blangenfeld@gmail.com</email>
  </author>
  <url>http://github.com/blangenfeld/acts_as_checkpoint/commit/b9fc773a6aba8053ef5adc6a06b252acbcd30398</url>
  <id>b9fc773a6aba8053ef5adc6a06b252acbcd30398</id>
  <committed-date>2008-08-13T23:11:11-07:00</committed-date>
  <authored-date>2008-08-13T23:11:11-07:00</authored-date>
  <message>Added tests for Knotfield::Acts::Checkpoint::Model.</message>
  <tree>aab2d03ee92f649d80f4edde36facd2201a1f603</tree>
  <committer>
    <name>Brian Langenfeld</name>
    <email>blangenfeld@gmail.com</email>
  </committer>
</commit>
