def test_upload_should_set_default_content_type
log_user('jsmith', 'jsmith')
assert_difference 'Attachment.count' do
- post "/uploads.js?attachment_id=1&filename=foo.txt",
+ post(
+ "/uploads.js?attachment_id=1&filename=foo.txt",
:params => "File content",
- :headers => {"CONTENT_TYPE" => 'application/octet-stream'}
+ :headers => {"CONTENT_TYPE" => 'application/octet-stream'})
assert_response :success
end
attachment = Attachment.order(:id => :desc).first
def test_upload_should_accept_content_type_param
log_user('jsmith', 'jsmith')
assert_difference 'Attachment.count' do
- post "/uploads.js?attachment_id=1&filename=foo&content_type=image/jpeg",
+ post(
+ "/uploads.js?attachment_id=1&filename=foo&content_type=image/jpeg",
:params => "File content",
- :headers => {"CONTENT_TYPE" => 'application/octet-stream'}
+ :headers => {"CONTENT_TYPE" => 'application/octet-stream'})
assert_response :success
end
attachment = Attachment.order(:id => :desc).first
def ajax_upload(filename, content, attachment_id=1)
assert_difference 'Attachment.count' do
- post "/uploads.js?attachment_id=#{attachment_id}&filename=#{filename}",
+ post(
+ "/uploads.js?attachment_id=#{attachment_id}&filename=#{filename}",
:params => content,
- :headers => {"CONTENT_TYPE" => 'application/octet-stream'}
+ :headers => {"CONTENT_TYPE" => 'application/octet-stream'})
assert_response :success
assert_equal 'text/javascript', response.content_type
end