summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-09-30 18:22:46 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-09-30 18:22:46 +0000
commit86ba692bf5312b37b6e30778d14daf0a675254bb (patch)
tree6e1f42db58dc520e33c1e464c88840d627b3772f /test
parentd06a1a7fa47a2c3b02e9d97034e6acaf2dc5a01d (diff)
downloadredmine-86ba692bf5312b37b6e30778d14daf0a675254bb.tar.gz
redmine-86ba692bf5312b37b6e30778d14daf0a675254bb.zip
Refactor: split UsersController#edit into #edit and #update
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4230 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/users_controller_test.rb16
-rw-r--r--test/integration/admin_test.rb2
-rw-r--r--test/integration/routing_test.rb3
3 files changed, 11 insertions, 10 deletions
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index 577f54b07..5e288d445 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -153,9 +153,9 @@ class UsersControllerTest < ActionController::TestCase
end
- def test_edit
+ def test_update
ActionMailer::Base.deliveries.clear
- post :edit, :id => 2, :user => {:firstname => 'Changed'}, :notification_option => 'all', :pref => {:hide_mail => '1', :comments_sorting => 'desc'}
+ put :update, :id => 2, :user => {:firstname => 'Changed'}, :notification_option => 'all', :pref => {:hide_mail => '1', :comments_sorting => 'desc'}
user = User.find(2)
assert_equal 'Changed', user.firstname
@@ -165,7 +165,7 @@ class UsersControllerTest < ActionController::TestCase
assert ActionMailer::Base.deliveries.empty?
end
- def test_edit_with_activation_should_send_a_notification
+ def test_update_with_activation_should_send_a_notification
u = User.new(:firstname => 'Foo', :lastname => 'Bar', :mail => 'foo.bar@somenet.foo', :language => 'fr')
u.login = 'foo'
u.status = User::STATUS_REGISTERED
@@ -173,7 +173,7 @@ class UsersControllerTest < ActionController::TestCase
ActionMailer::Base.deliveries.clear
Setting.bcc_recipients = '1'
- post :edit, :id => u.id, :user => {:status => User::STATUS_ACTIVE}
+ put :update, :id => u.id, :user => {:status => User::STATUS_ACTIVE}
assert u.reload.active?
mail = ActionMailer::Base.deliveries.last
assert_not_nil mail
@@ -181,12 +181,12 @@ class UsersControllerTest < ActionController::TestCase
assert mail.body.include?(ll('fr', :notice_account_activated))
end
- def test_edit_with_password_change_should_send_a_notification
+ def test_updat_with_password_change_should_send_a_notification
ActionMailer::Base.deliveries.clear
Setting.bcc_recipients = '1'
u = User.find(2)
- post :edit, :id => u.id, :user => {}, :password => 'newpass', :password_confirmation => 'newpass', :send_information => '1'
+ put :update, :id => u.id, :user => {}, :password => 'newpass', :password_confirmation => 'newpass', :send_information => '1'
assert_equal User.hash_password('newpass'), u.reload.hashed_password
mail = ActionMailer::Base.deliveries.last
@@ -195,13 +195,13 @@ class UsersControllerTest < ActionController::TestCase
assert mail.body.include?('newpass')
end
- test "POST :edit with a password change to an AuthSource user switching to Internal authentication" do
+ test "put :update with a password change to an AuthSource user switching to Internal authentication" do
# Configure as auth source
u = User.find(2)
u.auth_source = AuthSource.find(1)
u.save!
- post :edit, :id => u.id, :user => {:auth_source_id => ''}, :password => 'newpass', :password_confirmation => 'newpass'
+ put :update, :id => u.id, :user => {:auth_source_id => ''}, :password => 'newpass', :password_confirmation => 'newpass'
assert_equal nil, u.reload.auth_source
assert_equal User.hash_password('newpass'), u.reload.hashed_password
diff --git a/test/integration/admin_test.rb b/test/integration/admin_test.rb
index dd52859cf..0b736199b 100644
--- a/test/integration/admin_test.rb
+++ b/test/integration/admin_test.rb
@@ -35,7 +35,7 @@ class AdminTest < ActionController::IntegrationTest
assert_kind_of User, logged_user
assert_equal "Paul", logged_user.firstname
- post "users/edit", :id => user.id, :user => { :status => User::STATUS_LOCKED }
+ put "users/#{user.id}/edit", :id => user.id, :user => { :status => User::STATUS_LOCKED }
assert_redirected_to "/users/#{ user.id }/edit"
locked_user = User.try_to_login("psmith", "psmith09")
assert_equal nil, locked_user
diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb
index 341efe3cd..030f6b18a 100644
--- a/test/integration/routing_test.rb
+++ b/test/integration/routing_test.rb
@@ -251,10 +251,11 @@ class RoutingTest < ActionController::IntegrationTest
should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership'
should_route :post, "/users/new", :controller => 'users', :action => 'create'
- should_route :post, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123'
should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55'
should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12'
+
+ should_route :put, "/users/444/edit", :controller => 'users', :action => 'update', :id => '444'
end
# TODO: should they all be scoped under /projects/:project_id ?