diff --git a/app/views/users/_mail_notifications.html.erb b/app/views/users/_mail_notifications.html.erb index 58cb5a93f..e25d426ee 100644 --- a/app/views/users/_mail_notifications.html.erb +++ b/app/views/users/_mail_notifications.html.erb @@ -3,7 +3,7 @@ <%= select_tag 'user[mail_notification]', options_for_select(user_mail_notification_options(@user), @user.mail_notification), :onchange => 'if (this.value == "selected") {Element.show("notified-projects")} else {Element.hide("notified-projects")}' %>

-<% content_tag 'div', :id => 'notified-projects', :style => (@user.mail_notification == 'selected' ? '' : 'display:none;') do %> +<%= content_tag 'div', :id => 'notified-projects', :style => (@user.mail_notification == 'selected' ? '' : 'display:none;') do %>

<% @user.projects.each do |project| %>
<% end %>

diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index 4ed37c73d..27f725dc2 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -309,6 +309,29 @@ class UsersControllerTest < ActionController::TestCase assert u.check_password?('newpass') end + def test_update_notified_project + get :edit, :id => 2 + assert_response :success + assert_template 'edit' + u = User.find(2) + assert_equal [1, 2, 5], u.projects.collect{|p| p.id}.sort + assert_equal [1, 2, 5], u.notified_projects_ids.sort + assert_tag :tag => 'input', + :attributes => { + :id => 'notified_project_ids_', + :value => 1, + } + assert_equal 'all', u.mail_notification + put :update, :id => 2, + :user => { + :mail_notification => 'selected', + }, + :notified_project_ids => [1, 2] + u = User.find(2) + assert_equal 'selected', u.mail_notification + assert_equal [1, 2], u.notified_projects_ids.sort + end + def test_destroy assert_difference 'User.count', -1 do delete :destroy, :id => 2