]> source.dussan.org Git - redmine.git/commitdiff
Added some functional tests (issues).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 12 Dec 2007 22:22:33 +0000 (22:22 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 12 Dec 2007 22:22:33 +0000 (22:22 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@984 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/issues_controller_test.rb
test/unit/repository_bazaar_test.rb

index 484ebc62b86978d62d13ca899fa7d96a75fc6adf..b9d232bfd66b5bc1ec4ba5aa446b9937870400b6 100644 (file)
@@ -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
index 22a1909908a602d14ac4c8ef0d3e89afd9356c24..6b21607bcc21f1b77bee8fb13d3f0b7f800486ce 100644 (file)
@@ -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)