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/functional/versions_controller_test.rb | |
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/functional/versions_controller_test.rb')
-rw-r--r-- | test/functional/versions_controller_test.rb | 34 |
1 files changed, 34 insertions, 0 deletions
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 |