##// END OF EJS Templates
The test email action should only be accessible with POST (#20203)....
Jean-Philippe Lang -
r14007:670340e543ce
parent child
Show More
@@ -30,7 +30,7
30 30 </fieldset>
31 31
32 32 <div style="float:right;">
33 <%= link_to l(:label_send_test_email), :controller => 'admin', :action => 'test_email' %>
33 <%= link_to l(:label_send_test_email), { :controller => 'admin', :action => 'test_email' }, :method => :post %>
34 34 </div>
35 35
36 36 <%= submit_tag l(:button_save) %>
@@ -324,7 +324,7 Rails.application.routes.draw do
324 324 match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get
325 325 match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get
326 326 match 'admin/info', :controller => 'admin', :action => 'info', :via => :get
327 match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get
327 match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :post
328 328 match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post
329 329
330 330 resources :auth_sources do
@@ -87,7 +87,7 class AdminControllerTest < ActionController::TestCase
87 87 user.pref.save!
88 88 ActionMailer::Base.deliveries.clear
89 89
90 get :test_email
90 post :test_email
91 91 assert_redirected_to '/settings?tab=notifications'
92 92 mail = ActionMailer::Base.deliveries.last
93 93 assert_not_nil mail
@@ -97,7 +97,7 class AdminControllerTest < ActionController::TestCase
97 97
98 98 def test_test_email_failure_should_display_the_error
99 99 Mailer.stubs(:test_email).raises(Exception, 'Some error message')
100 get :test_email
100 post :test_email
101 101 assert_redirected_to '/settings?tab=notifications'
102 102 assert_match /Some error message/, flash[:error]
103 103 end
@@ -23,7 +23,7 class RoutingAdminTest < Redmine::RoutingTest
23 23 should_route 'GET /admin/projects' => 'admin#projects'
24 24 should_route 'GET /admin/plugins' => 'admin#plugins'
25 25 should_route 'GET /admin/info' => 'admin#info'
26 should_route 'GET /admin/test_email' => 'admin#test_email'
26 should_route 'POST /admin/test_email' => 'admin#test_email'
27 27 should_route 'POST /admin/default_configuration' => 'admin#default_configuration'
28 28 end
29 29 end
General Comments 0
You need to be logged in to leave comments. Login now