mirror of
https://github.com/redmine/redmine.git
synced 2025-11-10 15:26:03 +01:00
The test email action should only be accessible with POST (#20203).
git-svn-id: http://svn.redmine.org/redmine/trunk@14389 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
</fieldset>
|
||||
|
||||
<div style="float:right;">
|
||||
<%= link_to l(:label_send_test_email), :controller => 'admin', :action => 'test_email' %>
|
||||
<%= link_to l(:label_send_test_email), { :controller => 'admin', :action => 'test_email' }, :method => :post %>
|
||||
</div>
|
||||
|
||||
<%= submit_tag l(:button_save) %>
|
||||
|
||||
@@ -324,7 +324,7 @@ Rails.application.routes.draw do
|
||||
match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get
|
||||
match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get
|
||||
match 'admin/info', :controller => 'admin', :action => 'info', :via => :get
|
||||
match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get
|
||||
match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :post
|
||||
match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post
|
||||
|
||||
resources :auth_sources do
|
||||
|
||||
@@ -87,7 +87,7 @@ class AdminControllerTest < ActionController::TestCase
|
||||
user.pref.save!
|
||||
ActionMailer::Base.deliveries.clear
|
||||
|
||||
get :test_email
|
||||
post :test_email
|
||||
assert_redirected_to '/settings?tab=notifications'
|
||||
mail = ActionMailer::Base.deliveries.last
|
||||
assert_not_nil mail
|
||||
@@ -97,7 +97,7 @@ class AdminControllerTest < ActionController::TestCase
|
||||
|
||||
def test_test_email_failure_should_display_the_error
|
||||
Mailer.stubs(:test_email).raises(Exception, 'Some error message')
|
||||
get :test_email
|
||||
post :test_email
|
||||
assert_redirected_to '/settings?tab=notifications'
|
||||
assert_match /Some error message/, flash[:error]
|
||||
end
|
||||
|
||||
@@ -23,7 +23,7 @@ class RoutingAdminTest < Redmine::RoutingTest
|
||||
should_route 'GET /admin/projects' => 'admin#projects'
|
||||
should_route 'GET /admin/plugins' => 'admin#plugins'
|
||||
should_route 'GET /admin/info' => 'admin#info'
|
||||
should_route 'GET /admin/test_email' => 'admin#test_email'
|
||||
should_route 'POST /admin/test_email' => 'admin#test_email'
|
||||
should_route 'POST /admin/default_configuration' => 'admin#default_configuration'
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user