Changes ProjectsController#modules param name and add tests.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4647 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
072c4ad14c
commit
9222cf91ea
|
@ -204,9 +204,10 @@ class ProjectsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
verify :method => :post, :only => :modules, :render => {:nothing => true, :status => :method_not_allowed }
|
||||||
def modules
|
def modules
|
||||||
@project.enabled_module_names = params[:enabled_modules]
|
@project.enabled_module_names = params[:enabled_module_names]
|
||||||
flash[:notice] = l(:notice_successful_update)
|
flash[:notice] = l(:notice_successful_update)
|
||||||
redirect_to :action => 'settings', :id => @project, :tab => 'modules'
|
redirect_to :action => 'settings', :id => @project, :tab => 'modules'
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<legend><%= l(:text_select_project_modules) %></legend>
|
<legend><%= l(:text_select_project_modules) %></legend>
|
||||||
|
|
||||||
<% Redmine::AccessControl.available_project_modules.each do |m| %>
|
<% Redmine::AccessControl.available_project_modules.each do |m| %>
|
||||||
<p><label><%= check_box_tag 'enabled_modules[]', m, @project.module_enabled?(m) -%>
|
<p><label><%= check_box_tag 'enabled_module_names[]', m, @project.module_enabled?(m) -%>
|
||||||
<%= l_or_humanize(m, :prefix => "project_module_") %></label></p>
|
<%= l_or_humanize(m, :prefix => "project_module_") %></label></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -288,15 +288,10 @@ class ProjectsControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "GET :create" do
|
def test_create_should_not_accept_get
|
||||||
setup do
|
@request.session[:user_id] = 1
|
||||||
@request.session[:user_id] = 1
|
get :create
|
||||||
end
|
assert_response :method_not_allowed
|
||||||
|
|
||||||
should "not be allowed" do
|
|
||||||
get :create
|
|
||||||
assert_response :method_not_allowed
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_by_id
|
def test_show_by_id
|
||||||
|
@ -376,6 +371,21 @@ class ProjectsControllerTest < ActionController::TestCase
|
||||||
project = Project.find(1)
|
project = Project.find(1)
|
||||||
assert_equal 'Test changed name', project.name
|
assert_equal 'Test changed name', project.name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_modules
|
||||||
|
@request.session[:user_id] = 2
|
||||||
|
Project.find(1).enabled_module_names = ['issue_tracking', 'news']
|
||||||
|
|
||||||
|
post :modules, :id => 1, :enabled_module_names => ['issue_tracking', 'repository', 'documents']
|
||||||
|
assert_redirected_to '/projects/ecookbook/settings/modules'
|
||||||
|
assert_equal ['documents', 'issue_tracking', 'repository'], Project.find(1).enabled_module_names.sort
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_modules_should_not_allow_get
|
||||||
|
@request.session[:user_id] = 1
|
||||||
|
get :modules, :id => 1
|
||||||
|
assert_response :method_not_allowed
|
||||||
|
end
|
||||||
|
|
||||||
def test_get_destroy
|
def test_get_destroy
|
||||||
@request.session[:user_id] = 1 # admin
|
@request.session[:user_id] = 1 # admin
|
||||||
|
|
Loading…
Reference in New Issue