comparison test/functional/auth_sources_controller_test.rb @ 909:cbb26bc654de redmine-1.3

Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author Chris Cannam
date Fri, 24 Feb 2012 19:09:32 +0000
parents cbce1fd3b1b7
children 433d4f72a19b
comparison
equal deleted inserted replaced
908:c6c2cbd0afee 909:cbb26bc654de
1 require File.expand_path('../../test_helper', __FILE__) 1 require File.expand_path('../../test_helper', __FILE__)
2 2
3 class AuthSourcesControllerTest < ActionController::TestCase 3 class AuthSourcesControllerTest < ActionController::TestCase
4 fixtures :all
5 4
6 def setup 5 def setup
7 @request.session[:user_id] = 1 6 @request.session[:user_id] = 1
8 end 7 end
9 8
67 66
68 context "post :destroy" do 67 context "post :destroy" do
69 setup do 68 setup do
70 @auth_source = AuthSource.generate!(:name => 'TestEdit') 69 @auth_source = AuthSource.generate!(:name => 'TestEdit')
71 end 70 end
72 71
73 context "without users" do 72 context "without users" do
74 setup do 73 setup do
75 post :destroy, :id => @auth_source.id 74 post :destroy, :id => @auth_source.id
76 end 75 end
77 76
78 should_respond_with :redirect 77 should_respond_with :redirect
79 should_redirect_to("index") {{:action => 'index'}} 78 should_redirect_to("index") {{:action => 'index'}}
80 should_set_the_flash_to /deletion/i 79 should_set_the_flash_to /deletion/i
81 end 80 end
82 81
83 context "with users" do 82 context "with users" do
84 setup do 83 setup do
85 User.generate!(:auth_source => @auth_source) 84 User.generate!(:auth_source => @auth_source)
86 post :destroy, :id => @auth_source.id 85 post :destroy, :id => @auth_source.id
87 end 86 end
88 87
89 should_respond_with :redirect 88 should_respond_with :redirect
90 should "not destroy the AuthSource" do 89 should "not destroy the AuthSource" do
91 assert AuthSource.find(@auth_source.id) 90 assert AuthSource.find(@auth_source.id)
92 end 91 end
93 end 92 end