GitLab steht wegen Wartungsarbeiten am Montag, den 10. Mai, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

Commit dc869f47 authored by jplang's avatar jplang

Code cleanup.

git-svn-id: https://svn.redmine.org/redmine/trunk@14771 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent bf5d700d
......@@ -37,11 +37,12 @@ class IssuesTest < Redmine::IntegrationTest
# create an issue
def test_add_issue
log_user('jsmith', 'jsmith')
get '/projects/1/issues/new', :tracker_id => '1'
get '/projects/ecookbook/issues/new', :tracker_id => '1'
assert_response :success
assert_template 'issues/new'
post '/projects/1/issues', :tracker_id => "1",
issue = new_record(Issue) do
post '/projects/ecookbook/issues', :tracker_id => "1",
:issue => { :start_date => "2006-12-26",
:priority_id => "4",
:subject => "new test issue",
......@@ -51,10 +52,7 @@ class IssuesTest < Redmine::IntegrationTest
:due_date => "",
:assigned_to_id => "" },
:custom_fields => {'2' => 'Value for field 2'}
# find created issue
issue = Issue.find_by_subject("new test issue")
assert_kind_of Issue, issue
end
# check redirection
assert_redirected_to :controller => 'issues', :action => 'show', :id => issue
follow_redirect!
......@@ -79,11 +77,10 @@ class IssuesTest < Redmine::IntegrationTest
Role.anonymous.remove_permission! :add_issues
Member.create!(:project_id => 1, :principal => Group.anonymous, :role_ids => [3])
assert_difference 'Issue.count' do
issue = new_record(Issue) do
post '/projects/1/issues', :tracker_id => "1", :issue => {:subject => "new test issue"}
assert_response 302
end
assert_response 302
issue = Issue.order("id DESC").first
assert_equal User.anonymous, issue.author
end
......@@ -92,15 +89,15 @@ class IssuesTest < Redmine::IntegrationTest
log_user('jsmith', 'jsmith')
set_tmp_attachments_directory
put '/issues/1',
:notes => 'Some notes',
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}
assert_redirected_to "/issues/1"
attachment = new_record(Attachment) do
put '/issues/1',
:notes => 'Some notes',
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}
assert_redirected_to "/issues/1"
end
# make sure attachment was saved
attachment = Issue.find(1).attachments.find_by_filename("testfile.txt")
assert_kind_of Attachment, attachment
assert_equal Issue.find(1), attachment.container
assert_equal 'testfile.txt', attachment.filename
assert_equal 'This is an attachment', attachment.description
# verify the size of the attachment stored in db
#assert_equal file_data_1.length, attachment.filesize
......@@ -159,7 +156,7 @@ class IssuesTest < Redmine::IntegrationTest
end
# Create issue
assert_difference 'Issue.count' do
issue = new_record(Issue) do
post '/projects/ecookbook/issues',
:issue => {
:tracker_id => '1',
......@@ -167,9 +164,8 @@ class IssuesTest < Redmine::IntegrationTest
:subject => 'Issue with user custom field',
:custom_field_values => {@field.id.to_s => users.first.id.to_s}
}
assert_response 302
end
issue = Issue.order('id DESC').first
assert_response 302
# Issue view
follow_redirect!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment