diff test/functional/auth_sources_controller_test.rb @ 511:107d36338b70 live

Merge from branch "cannam"
author Chris Cannam
date Thu, 14 Jul 2011 10:43:07 +0100
parents cbce1fd3b1b7
children cbb26bc654de
line wrap: on
line diff
--- a/test/functional/auth_sources_controller_test.rb	Thu Jun 09 16:51:06 2011 +0100
+++ b/test/functional/auth_sources_controller_test.rb	Thu Jul 14 10:43:07 2011 +0100
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../test_helper'
+require File.expand_path('../../test_helper', __FILE__)
 
 class AuthSourcesControllerTest < ActionController::TestCase
   fixtures :all
@@ -66,18 +66,30 @@
   end
 
   context "post :destroy" do
+    setup do
+      @auth_source = AuthSource.generate!(:name => 'TestEdit')
+    end
+    
     context "without users" do
       setup do
-        @auth_source = AuthSource.generate!(:name => 'TestEdit')
         post :destroy, :id => @auth_source.id
       end
 
       should_respond_with :redirect
       should_redirect_to("index") {{:action => 'index'}}
       should_set_the_flash_to /deletion/i
-
     end
     
-    should "be tested with users"
+    context "with users" do
+      setup do
+        User.generate!(:auth_source => @auth_source)
+        post :destroy, :id => @auth_source.id
+      end
+      
+      should_respond_with :redirect
+      should "not destroy the AuthSource" do
+        assert AuthSource.find(@auth_source.id)
+      end
+    end
   end
 end