diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-03-06 18:25:01 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-03-06 18:25:01 +0000 |
commit | 729bea1cf38ed80bc34c47a8ef3783d9e06ce5c5 (patch) | |
tree | 641eec746b7102036dc717e62481a3de596133d6 /test | |
parent | 2af97616f760f1ba1bfda96cc91d51e2f3ac0b43 (diff) | |
download | redmine-729bea1cf38ed80bc34c47a8ef3783d9e06ce5c5.tar.gz redmine-729bea1cf38ed80bc34c47a8ef3783d9e06ce5c5.zip |
Moves ProjectsController#add_version to VersionsController#new.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3548 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/projects_controller_test.rb | 35 | ||||
-rw-r--r-- | test/functional/versions_controller_test.rb | 34 |
2 files changed, 34 insertions, 35 deletions
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 6de55d1b4..f4fe8dae5 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -329,41 +329,6 @@ class ProjectsControllerTest < ActionController::TestCase assert_equal 'Test changed name', project.name end - def test_add_version_routing - assert_routing( - {:method => :get, :path => 'projects/64/versions/new'}, - :controller => 'projects', :action => 'add_version', :id => '64' - ) - assert_routing( - #TODO: use PUT - {:method => :post, :path => 'projects/64/versions/new'}, - :controller => 'projects', :action => 'add_version', :id => '64' - ) - end - - def test_add_version - @request.session[:user_id] = 2 # manager - assert_difference 'Version.count' do - post :add_version, :id => '1', :version => {:name => 'test_add_version'} - end - assert_redirected_to '/projects/ecookbook/settings/versions' - version = Version.find_by_name('test_add_version') - assert_not_nil version - assert_equal 1, version.project_id - end - - def test_add_version_from_issue_form - @request.session[:user_id] = 2 # manager - assert_difference 'Version.count' do - xhr :post, :add_version, :id => '1', :version => {:name => 'test_add_version_from_issue_form'} - end - assert_response :success - assert_select_rjs :replace, 'issue_fixed_version_id' - version = Version.find_by_name('test_add_version_from_issue_form') - assert_not_nil version - assert_equal 1, version.project_id - end - def test_add_issue_category_routing assert_routing( {:method => :get, :path => 'projects/test/categories/new'}, diff --git a/test/functional/versions_controller_test.rb b/test/functional/versions_controller_test.rb index ebac584c4..46a5db916 100644 --- a/test/functional/versions_controller_test.rb +++ b/test/functional/versions_controller_test.rb @@ -40,6 +40,40 @@ class VersionsControllerTest < ActionController::TestCase assert_tag :tag => 'h2', :content => /1.0/ end + def test_new_routing + assert_routing( + {:method => :get, :path => 'projects/foo/versions/new'}, + :controller => 'versions', :action => 'new', :project_id => 'foo' + ) + assert_routing( + {:method => :post, :path => 'projects/foo/versions/new'}, + :controller => 'versions', :action => 'new', :project_id => 'foo' + ) + end + + def test_new + @request.session[:user_id] = 2 # manager + assert_difference 'Version.count' do + post :new, :project_id => '1', :version => {:name => 'test_add_version'} + end + assert_redirected_to '/projects/ecookbook/settings/versions' + version = Version.find_by_name('test_add_version') + assert_not_nil version + assert_equal 1, version.project_id + end + + def test_new_from_issue_form + @request.session[:user_id] = 2 # manager + assert_difference 'Version.count' do + xhr :post, :new, :project_id => '1', :version => {:name => 'test_add_version_from_issue_form'} + end + assert_response :success + assert_select_rjs :replace, 'issue_fixed_version_id' + version = Version.find_by_name('test_add_version_from_issue_form') + assert_not_nil version + assert_equal 1, version.project_id + end + def test_get_edit @request.session[:user_id] = 2 get :edit, :id => 2 |