From: Jean-Philippe Lang Date: Wed, 12 Dec 2007 22:22:33 +0000 (+0000) Subject: Added some functional tests (issues). X-Git-Tag: 0.6.2~21 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=63ef594033da88cf0e18839f706d86e353f3bd5b;p=redmine.git Added some functional tests (issues). git-svn-id: http://redmine.rubyforge.org/svn/trunk@984 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 484ebc62b..b9d232bfd 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -83,4 +83,71 @@ class IssuesControllerTest < Test::Unit::TestCase assert_not_nil assigns(:changes) assert_equal 'application/atom+xml', @response.content_type end + + def test_show + get :show, :id => 1 + assert_response :success + assert_template 'show.rhtml' + assert_not_nil assigns(:issue) + end + + def test_get_edit + @request.session[:user_id] = 2 + get :edit, :id => 1 + assert_response :success + assert_template 'edit' + assert_not_nil assigns(:issue) + assert_equal Issue.find(1), assigns(:issue) + end + + def test_post_edit + @request.session[:user_id] = 2 + post :edit, :id => 1, :issue => {:subject => 'Modified subject'} + assert_redirected_to 'issues/show/1' + assert_equal 'Modified subject', Issue.find(1).subject + end + + def test_post_change_status + issue = Issue.find(1) + assert_equal 1, issue.status_id + @request.session[:user_id] = 2 + post :change_status, :id => 1, + :new_status_id => 2, + :issue => { :assigned_to_id => 3 }, + :notes => 'Assigned to dlopper', + :confirm => 1 + assert_redirected_to 'issues/show/1' + issue.reload + assert_equal 2, issue.status_id + j = issue.journals.find(:first, :order => 'created_on DESC') + assert_equal 'Assigned to dlopper', j.notes + assert_equal 2, j.details.size + end + + def test_context_menu + @request.session[:user_id] = 2 + get :context_menu, :id => 1 + assert_response :success + assert_template 'context_menu' + end + + def test_destroy + @request.session[:user_id] = 2 + post :destroy, :id => 1 + assert_redirected_to 'projects/1/issues' + assert_nil Issue.find_by_id(1) + end + + def test_destroy_attachment + issue = Issue.find(3) + a = issue.attachments.size + @request.session[:user_id] = 2 + post :destroy_attachment, :id => 3, :attachment_id => 1 + assert_redirected_to 'issues/show/3' + assert_nil Attachment.find_by_id(1) + issue.reload + assert_equal((a-1), issue.attachments.size) + j = issue.journals.find(:first, :order => 'created_on DESC') + assert_equal 'attachment', j.details.first.property + end end diff --git a/test/unit/repository_bazaar_test.rb b/test/unit/repository_bazaar_test.rb index 22a190990..6b21607bc 100644 --- a/test/unit/repository_bazaar_test.rb +++ b/test/unit/repository_bazaar_test.rb @@ -21,7 +21,7 @@ class RepositoryBazaarTest < Test::Unit::TestCase fixtures :projects # No '..' in the repository path - REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + 'tmp/test/bazaar_repository' + REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/bazaar_repository' def setup @project = Project.find(1)