@@ -205,8 +205,9 class ProjectsController < ApplicationController | |||
|
205 | 205 | end |
|
206 | 206 | end |
|
207 | 207 | |
|
208 | verify :method => :post, :only => :modules, :render => {:nothing => true, :status => :method_not_allowed } | |
|
208 | 209 | def modules |
|
209 | @project.enabled_module_names = params[:enabled_modules] | |
|
210 | @project.enabled_module_names = params[:enabled_module_names] | |
|
210 | 211 | flash[:notice] = l(:notice_successful_update) |
|
211 | 212 | redirect_to :action => 'settings', :id => @project, :tab => 'modules' |
|
212 | 213 | end |
@@ -7,7 +7,7 | |||
|
7 | 7 | <legend><%= l(:text_select_project_modules) %></legend> |
|
8 | 8 | |
|
9 | 9 | <% Redmine::AccessControl.available_project_modules.each do |m| %> |
|
10 | <p><label><%= check_box_tag 'enabled_modules[]', m, @project.module_enabled?(m) -%> | |
|
10 | <p><label><%= check_box_tag 'enabled_module_names[]', m, @project.module_enabled?(m) -%> | |
|
11 | 11 | <%= l_or_humanize(m, :prefix => "project_module_") %></label></p> |
|
12 | 12 | <% end %> |
|
13 | 13 | </fieldset> |
@@ -288,16 +288,11 class ProjectsControllerTest < ActionController::TestCase | |||
|
288 | 288 | end |
|
289 | 289 | end |
|
290 | 290 | |
|
291 | context "GET :create" do | |
|
292 | setup do | |
|
291 | def test_create_should_not_accept_get | |
|
293 | 292 |
|
|
294 | end | |
|
295 | ||
|
296 | should "not be allowed" do | |
|
297 | 293 |
|
|
298 | 294 |
|
|
299 | 295 |
|
|
300 | end | |
|
301 | 296 | |
|
302 | 297 | def test_show_by_id |
|
303 | 298 | get :show, :id => 1 |
@@ -377,6 +372,21 class ProjectsControllerTest < ActionController::TestCase | |||
|
377 | 372 | assert_equal 'Test changed name', project.name |
|
378 | 373 | end |
|
379 | 374 | |
|
375 | def test_modules | |
|
376 | @request.session[:user_id] = 2 | |
|
377 | Project.find(1).enabled_module_names = ['issue_tracking', 'news'] | |
|
378 | ||
|
379 | post :modules, :id => 1, :enabled_module_names => ['issue_tracking', 'repository', 'documents'] | |
|
380 | assert_redirected_to '/projects/ecookbook/settings/modules' | |
|
381 | assert_equal ['documents', 'issue_tracking', 'repository'], Project.find(1).enabled_module_names.sort | |
|
382 | end | |
|
383 | ||
|
384 | def test_modules_should_not_allow_get | |
|
385 | @request.session[:user_id] = 1 | |
|
386 | get :modules, :id => 1 | |
|
387 | assert_response :method_not_allowed | |
|
388 | end | |
|
389 | ||
|
380 | 390 | def test_get_destroy |
|
381 | 391 | @request.session[:user_id] = 1 # admin |
|
382 | 392 | get :destroy, :id => 1 |
General Comments 0
You need to be logged in to leave comments.
Login now