diff --git a/test/functional/auth_sources_controller_test.rb b/test/functional/auth_sources_controller_test.rb index eadbaa73..5f65f419 100644 --- a/test/functional/auth_sources_controller_test.rb +++ b/test/functional/auth_sources_controller_test.rb @@ -66,18 +66,30 @@ class AuthSourcesControllerTest < ActionController::TestCase 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