comparison 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
comparison
equal deleted inserted replaced
451:a9f6345cb43d 511:107d36338b70
1 require File.dirname(__FILE__) + '/../test_helper' 1 require File.expand_path('../../test_helper', __FILE__)
2 2
3 class AuthSourcesControllerTest < ActionController::TestCase 3 class AuthSourcesControllerTest < ActionController::TestCase
4 fixtures :all 4 fixtures :all
5 5
6 def setup 6 def setup
64 should_redirect_to("index") {{:action => 'index'}} 64 should_redirect_to("index") {{:action => 'index'}}
65 should_set_the_flash_to /update/i 65 should_set_the_flash_to /update/i
66 end 66 end
67 67
68 context "post :destroy" do 68 context "post :destroy" do
69 setup do
70 @auth_source = AuthSource.generate!(:name => 'TestEdit')
71 end
72
69 context "without users" do 73 context "without users" do
70 setup do 74 setup do
71 @auth_source = AuthSource.generate!(:name => 'TestEdit')
72 post :destroy, :id => @auth_source.id 75 post :destroy, :id => @auth_source.id
73 end 76 end
74 77
75 should_respond_with :redirect 78 should_respond_with :redirect
76 should_redirect_to("index") {{:action => 'index'}} 79 should_redirect_to("index") {{:action => 'index'}}
77 should_set_the_flash_to /deletion/i 80 should_set_the_flash_to /deletion/i
78
79 end 81 end
80 82
81 should "be tested with users" 83 context "with users" do
84 setup do
85 User.generate!(:auth_source => @auth_source)
86 post :destroy, :id => @auth_source.id
87 end
88
89 should_respond_with :redirect
90 should "not destroy the AuthSource" do
91 assert AuthSource.find(@auth_source.id)
92 end
93 end
82 end 94 end
83 end 95 end