##// END OF EJS Templates
Move the file viewer to a partial....
Move the file viewer to a partial. git-svn-id: http://redmine.rubyforge.org/svn/trunk@1519 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r1242:83061e9ca29a
r1505:aa0beecad0fa
Show More
issues_test.rb
71 lines | 2.6 KiB | text/x-ruby | RubyLexer
Jean-Philippe Lang
added issues integration tests...
r121 require "#{File.dirname(__FILE__)}/../test_helper"
class IssuesTest < ActionController::IntegrationTest
Jean-Philippe Lang
Added default value for custom fields. Fixed javascript on custom field form for project and user custom fields....
r1076 fixtures :projects,
:users,
:trackers,
:projects_trackers,
:issue_statuses,
:issues,
:enumerations,
:custom_fields,
:custom_values,
:custom_fields_trackers
Jean-Philippe Lang
added issues integration tests...
r121
# create an issue
def test_add_issue
log_user('jsmith', 'jsmith')
Jean-Philippe Lang
ProjectsController#add_issue moved to IssuesController#new....
r1066 get 'projects/1/issues/new', :tracker_id => '1'
Jean-Philippe Lang
added issues integration tests...
r121 assert_response :success
Jean-Philippe Lang
ProjectsController#add_issue moved to IssuesController#new....
r1066 assert_template 'issues/new'
Jean-Philippe Lang
added issues integration tests...
r121
Jean-Philippe Lang
ProjectsController#add_issue moved to IssuesController#new....
r1066 post 'projects/1/issues/new', :tracker_id => "1",
Jean-Philippe Lang
added issues integration tests...
r121 :issue => { :start_date => "2006-12-26",
:priority_id => "3",
:subject => "new test issue",
:category_id => "",
:description => "new issue",
:done_ratio => "0",
:due_date => "",
Jean-Philippe Lang
Added default value for custom fields. Fixed javascript on custom field form for project and user custom fields....
r1076 :assigned_to_id => "" },
:custom_fields => {'2' => 'Value for field 2'}
Jean-Philippe Lang
added issues integration tests...
r121 # find created issue
issue = Issue.find_by_subject("new test issue")
assert_kind_of Issue, issue
# check redirection
Jean-Philippe Lang
Fix tests broken by r1243 (Redirect to issue page after creating a new issue)....
r1242 assert_redirected_to "issues/show"
Jean-Philippe Lang
added issues integration tests...
r121 follow_redirect!
Jean-Philippe Lang
Fix tests broken by r1243 (Redirect to issue page after creating a new issue)....
r1242 assert_equal issue, assigns(:issue)
Jean-Philippe Lang
added issues integration tests...
r121
# check issue attributes
assert_equal 'jsmith', issue.author.login
assert_equal 1, issue.project.id
assert_equal 1, issue.status.id
end
# add then remove 2 attachments to an issue
def test_issue_attachements
log_user('jsmith', 'jsmith')
Jean-Philippe Lang
Merged IssuesController #edit and #update into a single actions....
r1115 post 'issues/edit/1',
Jean-Philippe Lang
Merged IssuesController change_status and add_note actions....
r1030 :notes => 'Some notes',
Jean-Philippe Lang
Adds an optional description to attachments....
r1166 :attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}
Jean-Philippe Lang
added issues integration tests...
r121 assert_redirected_to "issues/show/1"
# make sure attachment was saved
Jean-Philippe Lang
file upload test now uses ActionController::TestUploadedFile...
r248 attachment = Issue.find(1).attachments.find_by_filename("testfile.txt")
Jean-Philippe Lang
added issues integration tests...
r121 assert_kind_of Attachment, attachment
assert_equal Issue.find(1), attachment.container
Jean-Philippe Lang
Adds an optional description to attachments....
r1166 assert_equal 'This is an attachment', attachment.description
Jean-Philippe Lang
added issues integration tests...
r121 # verify the size of the attachment stored in db
Jean-Philippe Lang
file upload test now uses ActionController::TestUploadedFile...
r248 #assert_equal file_data_1.length, attachment.filesize
Jean-Philippe Lang
added issues integration tests...
r121 # verify that the attachment was written to disk
assert File.exist?(attachment.diskfile)
# remove the attachments
Issue.find(1).attachments.each(&:destroy)
assert_equal 0, Issue.find(1).attachments.length
end
end