diff --git a/app/views/auth_sources/edit.html.erb b/app/views/auth_sources/edit.html.erb
index 87c72724d..f2d76002c 100644
--- a/app/views/auth_sources/edit.html.erb
+++ b/app/views/auth_sources/edit.html.erb
@@ -1,6 +1,6 @@
<%=l(:label_auth_source)%> (<%= h(@auth_source.auth_method_name) %>)
-<% form_tag({:action => 'update', :id => @auth_source}, :class => "tabular") do %>
+<% form_tag({:action => 'update', :id => @auth_source}, :method => :put, :class => "tabular") do %>
<%= render :partial => auth_source_partial_name(@auth_source) %>
<%= submit_tag l(:button_save) %>
<% end %>
diff --git a/app/views/auth_sources/index.html.erb b/app/views/auth_sources/index.html.erb
index f239184ae..30d3bad7f 100644
--- a/app/views/auth_sources/index.html.erb
+++ b/app/views/auth_sources/index.html.erb
@@ -22,7 +22,7 @@
<%= link_to l(:button_test), :action => 'test_connection', :id => source %>
<%= link_to l(:button_delete), { :action => 'destroy', :id => source },
- :method => :post,
+ :method => :delete,
:confirm => l(:text_are_you_sure),
:class => 'icon icon-del',
:disabled => source.users.any? %>
diff --git a/config/routes.rb b/config/routes.rb
index abf91729a..3e98e9043 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -353,22 +353,7 @@ ActionController::Routing::Routes.draw do |map|
map.connect 'admin/default_configuration', :controller => 'admin',
:action => 'default_configuration', :conditions => {:method => :post}
- # Used by AuthSourcesControllerTest
- # TODO : refactor *AuthSourcesController to remove these routes
- map.connect 'auth_sources', :controller => 'auth_sources',
- :action => 'index', :conditions => {:method => :get}
- map.connect 'auth_sources/new', :controller => 'auth_sources',
- :action => 'new', :conditions => {:method => :get}
- map.connect 'auth_sources/create', :controller => 'auth_sources',
- :action => 'create', :conditions => {:method => :post}
- map.connect 'auth_sources/destroy/:id', :controller => 'auth_sources',
- :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
- map.connect 'auth_sources/test_connection/:id', :controller => 'auth_sources',
- :action => 'test_connection', :conditions => {:method => :get}
- map.connect 'auth_sources/edit/:id', :controller => 'auth_sources',
- :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
- map.connect 'auth_sources/update/:id', :controller => 'auth_sources',
- :action => 'update', :id => /\d+/, :conditions => {:method => :post}
+ map.resources :auth_sources, :member => {:test_connection => :get}
map.connect 'workflows', :controller => 'workflows',
:action => 'index', :conditions => {:method => :get}
diff --git a/test/functional/auth_sources_controller_test.rb b/test/functional/auth_sources_controller_test.rb
index c7c297980..96dcb5c78 100644
--- a/test/functional/auth_sources_controller_test.rb
+++ b/test/functional/auth_sources_controller_test.rb
@@ -78,7 +78,7 @@ class AuthSourcesControllerTest < ActionController::TestCase
end
def test_update
- post :update, :id => 1, :auth_source => {:name => 'Renamed', :host => '192.168.0.10', :port => '389', :attr_login => 'uid'}
+ put :update, :id => 1, :auth_source => {:name => 'Renamed', :host => '192.168.0.10', :port => '389', :attr_login => 'uid'}
assert_redirected_to '/auth_sources'
source = AuthSourceLdap.find(1)
@@ -87,7 +87,7 @@ class AuthSourcesControllerTest < ActionController::TestCase
end
def test_update_with_failure
- post :update, :id => 1, :auth_source => {:name => 'Renamed', :host => '', :port => '389', :attr_login => 'uid'}
+ put :update, :id => 1, :auth_source => {:name => 'Renamed', :host => '', :port => '389', :attr_login => 'uid'}
assert_response :success
assert_template 'edit'
assert_error_tag :content => /host can't be blank/i
@@ -95,7 +95,7 @@ class AuthSourcesControllerTest < ActionController::TestCase
def test_destroy
assert_difference 'AuthSourceLdap.count', -1 do
- post :destroy, :id => 1
+ delete :destroy, :id => 1
end
end
@@ -103,7 +103,7 @@ class AuthSourcesControllerTest < ActionController::TestCase
User.find(2).update_attribute :auth_source_id, 1
assert_no_difference 'AuthSourceLdap.count' do
- post :destroy, :id => 1
+ delete :destroy, :id => 1
end
end
diff --git a/test/integration/routing/auth_sources_test.rb b/test/integration/routing/auth_sources_test.rb
index 255eeb6d4..4f7ca2104 100644
--- a/test/integration/routing/auth_sources_test.rb
+++ b/test/integration/routing/auth_sources_test.rb
@@ -28,28 +28,28 @@ class RoutingAuthSourcesTest < ActionController::IntegrationTest
{ :controller => 'auth_sources', :action => 'new' }
)
assert_routing(
- { :method => 'post', :path => "/auth_sources/create" },
+ { :method => 'post', :path => "/auth_sources" },
{ :controller => 'auth_sources', :action => 'create' }
)
assert_routing(
- { :method => 'post', :path => "/auth_sources/destroy/1234" },
- { :controller => 'auth_sources', :action => 'destroy',
- :id => '1234' }
- )
- assert_routing(
- { :method => 'get', :path => "/auth_sources/test_connection/1234" },
- { :controller => 'auth_sources', :action => 'test_connection',
- :id => '1234' }
- )
- assert_routing(
- { :method => 'get', :path => "/auth_sources/edit/1234" },
+ { :method => 'get', :path => "/auth_sources/1234/edit" },
{ :controller => 'auth_sources', :action => 'edit',
:id => '1234' }
)
assert_routing(
- { :method => 'post', :path => "/auth_sources/update/1234" },
+ { :method => 'put', :path => "/auth_sources/1234" },
{ :controller => 'auth_sources', :action => 'update',
:id => '1234' }
)
+ assert_routing(
+ { :method => 'delete', :path => "/auth_sources/1234" },
+ { :controller => 'auth_sources', :action => 'destroy',
+ :id => '1234' }
+ )
+ assert_routing(
+ { :method => 'get', :path => "/auth_sources/1234/test_connection" },
+ { :controller => 'auth_sources', :action => 'test_connection',
+ :id => '1234' }
+ )
end
end
|