@@ -3,7 +3,7 | |||
|
3 | 3 | <%= select_tag 'user[mail_notification]', options_for_select(user_mail_notification_options(@user), @user.mail_notification), |
|
4 | 4 | :onchange => 'if (this.value == "selected") {Element.show("notified-projects")} else {Element.hide("notified-projects")}' %> |
|
5 | 5 | </p> |
|
6 | <% content_tag 'div', :id => 'notified-projects', :style => (@user.mail_notification == 'selected' ? '' : 'display:none;') do %> | |
|
6 | <%= content_tag 'div', :id => 'notified-projects', :style => (@user.mail_notification == 'selected' ? '' : 'display:none;') do %> | |
|
7 | 7 | <p><% @user.projects.each do |project| %> |
|
8 | 8 | <label><%= check_box_tag 'notified_project_ids[]', project.id, @user.notified_projects_ids.include?(project.id) %> <%=h project.name %></label><br /> |
|
9 | 9 | <% end %></p> |
@@ -309,6 +309,29 class UsersControllerTest < ActionController::TestCase | |||
|
309 | 309 | assert u.check_password?('newpass') |
|
310 | 310 | end |
|
311 | 311 | |
|
312 | def test_update_notified_project | |
|
313 | get :edit, :id => 2 | |
|
314 | assert_response :success | |
|
315 | assert_template 'edit' | |
|
316 | u = User.find(2) | |
|
317 | assert_equal [1, 2, 5], u.projects.collect{|p| p.id}.sort | |
|
318 | assert_equal [1, 2, 5], u.notified_projects_ids.sort | |
|
319 | assert_tag :tag => 'input', | |
|
320 | :attributes => { | |
|
321 | :id => 'notified_project_ids_', | |
|
322 | :value => 1, | |
|
323 | } | |
|
324 | assert_equal 'all', u.mail_notification | |
|
325 | put :update, :id => 2, | |
|
326 | :user => { | |
|
327 | :mail_notification => 'selected', | |
|
328 | }, | |
|
329 | :notified_project_ids => [1, 2] | |
|
330 | u = User.find(2) | |
|
331 | assert_equal 'selected', u.mail_notification | |
|
332 | assert_equal [1, 2], u.notified_projects_ids.sort | |
|
333 | end | |
|
334 | ||
|
312 | 335 | def test_destroy |
|
313 | 336 | assert_difference 'User.count', -1 do |
|
314 | 337 | delete :destroy, :id => 2 |
General Comments 0
You need to be logged in to leave comments.
Login now