Project

General

Profile

Patch #20203 ยป 0001-Send-test-email-to-admins-with-POST.patch

Holger Just, 2015-06-29 16:40

View differences:

app/views/settings/_notifications.html.erb
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) %>
config/routes.rb
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
test/functional/admin_controller_test.rb
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
test/integration/routing/admin_test.rb
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
    (1-1/1)