<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/clearance/lib/extensions/errors.rb</filename>
    </added>
    <added>
      <filename>lib/clearance/lib/extensions/rescue.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -26,7 +26,7 @@ In config/environments/test.rb:
     config.gem 'thoughtbot-factory_girl',
       :lib     =&gt; 'factory_girl',
       :source  =&gt; &quot;http://gems.github.com&quot;, 
-      :version =&gt; '&gt;= 1.1.5'
+      :version =&gt; '&gt;= 1.2.0'
 
 Then:
 </diff>
      <filename>README.textile</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,7 @@ namespace :test do
   end
   
   Cucumber::Rake::Task.new(:features) do |t|
-    t.cucumber_opts = &quot;--format progress&quot;
+    t.cucumber_opts = &quot;--format pretty&quot;
     t.feature_pattern = 'test/rails_root/features/*.feature'
   end  
 end</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-Fature: Password Reset
+Feature: Password Reset
   In order to sign in even if he forgot his password
   A user
   Should be able to reset it
@@ -30,3 +30,10 @@ Fature: Password Reset
       And I sign in as &quot;email@person.com/newpassword&quot;
       Then I should be signed in
       
+    Scenario: User requests password reset without token
+      Given a user exists with an email of &quot;user@one.com&quot;
+      When I try to change the password of &quot;user@one.com&quot; without token
+      Then I should be forbidden
+
+
+</diff>
      <filename>generators/clearance_features/templates/features/password_reset.feature</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,13 @@ Then /^I should see error messages$/ do
   Then %{I should see &quot;error(s)? prohibited&quot;}
 end
 
-# DB
+# Database
+
+Factory.factories.each do |name, factory|
+  Given /^an? #{name} exists with an? (.*) of &quot;([^&quot;]*)&quot;$/ do |attr, value|
+    Factory(name, attr.gsub(' ', '_') =&gt; value)
+  end
+end
 
 Given /^there is no user with &quot;(.*)&quot;$/ do |email|
   assert_nil User.find_by_email(email)
@@ -68,6 +74,16 @@ When /^I follow the password reset link sent to &quot;(.*)&quot;$/ do |email|
   visit edit_user_password_path(:user_id =&gt; user, :token =&gt; user.token)
 end
 
+When /^I try to change the password of &quot;(.*)&quot; without token$/ do |email|
+  user = User.find_by_email(email)
+  visit edit_user_password_path(:user_id =&gt; user)
+end
+
+Then /^I should be forbidden$/ do
+  assert_response :forbidden
+end
+
+
 # Actions
 
 When /^I sign in( with &quot;remember me&quot;)? as &quot;(.*)\/(.*)&quot;$/ do |remember, email, password|</diff>
      <filename>generators/clearance_features/templates/features/step_definitions/clearance_steps.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,7 +10,6 @@ module NavigationHelpers
       new_session_path
     when /the password reset request page/i
       new_password_path
- 
     
     # Add more page name =&gt; path mappings here
     </diff>
      <filename>generators/clearance_features/templates/features/support/paths.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
-class Forbidden &lt; Exception; end
-
+require 'clearance/lib/extensions/errors'
+require 'clearance/lib/extensions/rescue'
 require 'clearance/app/controllers/application_controller'
 require 'clearance/app/controllers/confirmations_controller'
 require 'clearance/app/controllers/passwords_controller'</diff>
      <filename>lib/clearance.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,8 +7,6 @@ module Clearance
           controller.send(:include, InstanceMethods)
           
           controller.class_eval do
-            rescue_from Forbidden, :with =&gt; :forbid
-            
             helper_method :current_user
             helper_method :signed_in?
             
@@ -78,10 +76,6 @@ module Clearance
             flash[:failure] = flash_message if flash_message
             render :template =&gt; &quot;/sessions/new&quot;, :status =&gt; :unauthorized 
           end
-          
-          def forbid
-            render :nothing =&gt; true, :status =&gt; :forbidden
-          end
         end
         
       end</diff>
      <filename>lib/clearance/app/controllers/application_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -35,15 +35,21 @@ module Clearance
           
           def forbid_confirmed_user
             user = User.find_by_id(params[:user_id])
-            raise Forbidden if user &amp;&amp; user.email_confirmed?
+            if user &amp;&amp; user.email_confirmed?
+              raise ActionController::Forbidden, &quot;confirmed user&quot;
+            end
           end
           
           def forbid_missing_token
-            raise Forbidden if params[:token].blank?
+            if params[:token].blank?
+              raise ActionController::Forbidden, &quot;missing token&quot;
+            end
           end
           
           def forbid_non_existant_user
-            raise Forbidden unless User.find_by_id_and_token(params[:user_id], params[:token])
+            unless User.find_by_id_and_token(params[:user_id], params[:token])
+              raise ActionController::Forbidden, &quot;non-existant user&quot;
+            end
           end
 
           def url_after_create</diff>
      <filename>lib/clearance/app/controllers/confirmations_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -52,11 +52,15 @@ module Clearance
           private
           
           def forbid_missing_token
-            raise Forbidden if params[:token].blank?
+            if params[:token].blank?
+              raise ActionController::Forbidden, &quot;missing token&quot;
+            end
           end
           
           def forbid_non_existant_user
-            raise Forbidden unless User.find_by_id_and_token(params[:user_id], params[:token])
+            unless User.find_by_id_and_token(params[:user_id], params[:token])
+              raise ActionController::Forbidden, &quot;non-existant user&quot;
+            end
           end
 
           def url_after_create</diff>
      <filename>lib/clearance/app/controllers/passwords_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -27,42 +27,39 @@ module Clearance
                 should_redirect_to_url_after_create
               end
 
-              context &quot;on GET to #new with incorrect token&quot; do
+              context &quot;with an incorrect token&quot; do
                 setup do 
-                  bad_token = &quot;bad token&quot;
-                  assert_not_equal bad_token, @user.token
-                  get :new, :user_id =&gt; @user.to_param, :token =&gt; bad_token
+                  @bad_token = &quot;bad token&quot;
+                  assert_not_equal @bad_token, @user.token
                 end
                 
-                should_forbid
+                should_forbid &quot;on GET to #new with incorrect token&quot; do
+                  get :new, :user_id =&gt; @user.to_param, :token =&gt; @bad_token
+                end
               end
               
-              context &quot;on GET to #new with blank token&quot; do
-                setup { get :new, :user_id =&gt; @user.to_param, :token =&gt; &quot;&quot; }
-                should_forbid
+              should_forbid &quot;on GET to #new with blank token&quot; do
+                get :new, :user_id =&gt; @user.to_param, :token =&gt; &quot;&quot;
               end
               
-              context &quot;on GET to #new with no token&quot; do
-                setup { get :new, :user_id =&gt; @user.to_param }
-                should_forbid
+              should_forbid &quot;on GET to #new with no token&quot; do
+                get :new, :user_id =&gt; @user.to_param
               end
             end
 
             context &quot;a user with email confirmed&quot; do
               setup { @user = Factory(:email_confirmed_user) }
 
-              context &quot;on GET to #new with correct id&quot; do
-                setup { get :new, :user_id =&gt; @user.to_param }
-                should_forbid
+              should_forbid &quot;on GET to #new with correct id&quot; do
+                get :new, :user_id =&gt; @user.to_param
               end
             end
 
             context &quot;no users&quot; do
               setup { assert_equal 0, User.count }
               
-              context &quot;on GET to #new with nonexistent id and token&quot; do
-                setup { get :new, :user_id =&gt; '123', :token =&gt; '123' }
-                should_forbid
+              should_forbid &quot;on GET to #new with nonexistent id and token&quot; do
+                get :new, :user_id =&gt; '123', :token =&gt; '123'
               end
             end
 </diff>
      <filename>lib/clearance/test/functional/confirmations_controller_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -90,14 +90,12 @@ module Clearance
                 should_display_a_password_update_form
               end
               
-              context &quot;on GET to #edit with correct id but blank token&quot; do
-                setup { get :edit, :user_id =&gt; @user.to_param, :token =&gt; &quot;&quot; }
-                should_forbid
+              should_forbid &quot;on GET to #edit with correct id but blank token&quot; do
+                get :edit, :user_id =&gt; @user.to_param, :token =&gt; &quot;&quot;
               end
               
-              context &quot;on GET to #edit with correct id but no token&quot; do
-                setup { get :edit, :user_id =&gt; @user.to_param }
-                should_forbid
+              should_forbid &quot;on GET to #edit with correct id but no token&quot; do
+                get :edit, :user_id =&gt; @user.to_param
               end
               
               context &quot;on PUT to #update with matching password and password confirmation&quot; do
@@ -158,30 +156,20 @@ module Clearance
                 should_display_a_password_update_form                       
               end
               
-              context &quot;on PUT to #update with id but no token&quot; do
-                setup { put :update, :user_id =&gt; @user.to_param, :token =&gt; &quot;&quot; }
-              
-                should &quot;not update password&quot; do
-                  assert_not_equal @encrypted_new_password, @user.encrypted_password
-                end
-              
-                should_forbid                  
+              should_forbid &quot;on PUT to #update with id but no token&quot; do
+                put :update, :user_id =&gt; @user.to_param, :token =&gt; &quot;&quot;
               end
             end
             
-            context &quot;given two users&quot; do
+            context &quot;given two users and user one signs in&quot; do
               setup do
                 @user_one = Factory(:user)
                 @user_two = Factory(:user)
+                sign_in_as @user_one
               end
 
-              context &quot;when user one signs in&quot; do
-                setup { sign_in_as @user_one }
-
-                context &quot;and tries to change user two's password&quot; do
-                  setup { get :edit, :user_id =&gt; @user_two.to_param }
-                  should_forbid
-                end
+              should_forbid &quot;when user one tries to change user two's password on GET with no token&quot; do
+                get :edit, :user_id =&gt; @user_two.to_param
               end
             end  
           end</diff>
      <filename>lib/clearance/test/functional/passwords_controller_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -55,9 +55,12 @@ module Clearance
     
     # HTTP FLUENCY
     
-    def should_forbid 
-      should_respond_with :forbidden
-      should_render_nothing
+    def should_forbid(description, &amp;block)
+      should &quot;forbid #{description}&quot; do
+        assert_raises ActionController::Forbidden do
+          instance_eval(&amp;block)
+        end
+      end
     end
     
     # CONTEXTS</diff>
      <filename>shoulda_macros/clearance.rb</filename>
    </modified>
    <modified>
      <diff>@@ -23,11 +23,11 @@ config.action_mailer.delivery_method = :test
 
 HOST = &quot;localhost&quot;
 
-  config.gem 'thoughtbot-shoulda',
-    :lib     =&gt; 'shoulda',
-    :source  =&gt; &quot;http://gems.github.com&quot;, 
-    :version =&gt; '&gt;= 2.9.1'
-  config.gem 'thoughtbot-factory_girl',
-    :lib     =&gt; 'factory_girl',
-    :source  =&gt; &quot;http://gems.github.com&quot;, 
-    :version =&gt; '&gt;= 1.1.5'
+config.gem 'thoughtbot-shoulda',
+  :lib     =&gt; 'shoulda',
+  :source  =&gt; &quot;http://gems.github.com&quot;, 
+  :version =&gt; '&gt;= 2.9.1'
+config.gem 'thoughtbot-factory_girl',
+  :lib     =&gt; 'factory_girl',
+  :source  =&gt; &quot;http://gems.github.com&quot;, 
+  :version =&gt; '&gt;= 1.2.0'</diff>
      <filename>test/rails_root/config/environments/test.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/.specification</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/CONTRIBUTION_GUIDELINES.rdoc</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/Changelog</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/LICENSE</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/README.textile</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/Rakefile</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/lib/factory_girl.rb</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/lib/factory_girl/aliases.rb</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/lib/factory_girl/attribute.rb</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/lib/factory_girl/attribute_proxy.rb</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/lib/factory_girl/factory.rb</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/lib/factory_girl/sequence.rb</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/test/aliases_test.rb</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/test/attribute_proxy_test.rb</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/test/attribute_test.rb</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/test/factory_test.rb</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/test/integration_test.rb</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/test/models.rb</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/test/sequence_test.rb</filename>
    </removed>
    <removed>
      <filename>test/rails_root/vendor/gems/thoughtbot-factory_girl-1.1.5/test/test_helper.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>32cad8ef8c2c8949de120cf8b4dc65616d7c5d67</id>
    </parent>
  </parents>
  <author>
    <name>Dan Croak</name>
    <email>dcroak@thoughtbot.com</email>
  </author>
  <url>http://github.com/thoughtbot/clearance/commit/7cf5b77d31b4dd0714421db7d1d605702eea1677</url>
  <id>7cf5b77d31b4dd0714421db7d1d605702eea1677</id>
  <committed-date>2009-02-20T13:48:04-08:00</committed-date>
  <authored-date>2009-02-20T13:48:04-08:00</authored-date>
  <message>raising actual ActionController::Forbidden error, test for the raise in functional tests. test for the response code in acceptance test.</message>
  <tree>abc8596123097650b66732bec926295d7f4b242e</tree>
  <committer>
    <name>Dan Croak</name>
    <email>dcroak@thoughtbot.com</email>
  </committer>
</commit>
