Added some functional tests (issues).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@984 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
bd8eded670
commit
63ef594033
|
@ -83,4 +83,71 @@ class IssuesControllerTest < Test::Unit::TestCase
|
||||||
assert_not_nil assigns(:changes)
|
assert_not_nil assigns(:changes)
|
||||||
assert_equal 'application/atom+xml', @response.content_type
|
assert_equal 'application/atom+xml', @response.content_type
|
||||||
end
|
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
|
end
|
||||||
|
|
|
@ -21,7 +21,7 @@ class RepositoryBazaarTest < Test::Unit::TestCase
|
||||||
fixtures :projects
|
fixtures :projects
|
||||||
|
|
||||||
# No '..' in the repository path
|
# 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
|
def setup
|
||||||
@project = Project.find(1)
|
@project = Project.find(1)
|
||||||
|
|
Loading…
Reference in New Issue