mirror of
https://github.com/redmine/redmine.git
synced 2025-11-14 09:16:02 +01:00
Fix RuboCop offense Performance/FixedSize (#38146).
git-svn-id: https://svn.redmine.org/redmine/trunk@22030 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -486,11 +486,6 @@ Naming/VariableNumber:
|
|||||||
- 'test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb'
|
- 'test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb'
|
||||||
- 'test/unit/project_test.rb'
|
- 'test/unit/project_test.rb'
|
||||||
|
|
||||||
Performance/FixedSize:
|
|
||||||
Exclude:
|
|
||||||
- 'test/integration/api_test/issues_test.rb'
|
|
||||||
- 'test/integration/attachments_test.rb'
|
|
||||||
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
Performance/RedundantEqualityComparisonBlock:
|
Performance/RedundantEqualityComparisonBlock:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
|||||||
@@ -969,7 +969,8 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_create_issue_with_uploaded_file
|
def test_create_issue_with_uploaded_file
|
||||||
token = xml_upload('test_create_with_upload', credentials('jsmith'))
|
file_content = 'test_create_with_upload'
|
||||||
|
token = xml_upload(file_content, credentials('jsmith'))
|
||||||
attachment = Attachment.find_by_token(token)
|
attachment = Attachment.find_by_token(token)
|
||||||
|
|
||||||
# create the issue with the upload's token
|
# create the issue with the upload's token
|
||||||
@@ -991,7 +992,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
|
|||||||
attachment.reload
|
attachment.reload
|
||||||
assert_equal 'test.txt', attachment.filename
|
assert_equal 'test.txt', attachment.filename
|
||||||
assert_equal 'text/plain', attachment.content_type
|
assert_equal 'text/plain', attachment.content_type
|
||||||
assert_equal 'test_create_with_upload'.size, attachment.filesize
|
assert_equal file_content.size, attachment.filesize
|
||||||
assert_equal 2, attachment.author_id
|
assert_equal 2, attachment.author_id
|
||||||
|
|
||||||
# get the issue with its attachments
|
# get the issue with its attachments
|
||||||
|
|||||||
@@ -58,7 +58,8 @@ class AttachmentsTest < Redmine::IntegrationTest
|
|||||||
def test_upload_as_js_and_attach_to_an_issue
|
def test_upload_as_js_and_attach_to_an_issue
|
||||||
log_user('jsmith', 'jsmith')
|
log_user('jsmith', 'jsmith')
|
||||||
|
|
||||||
token = ajax_upload('myupload.txt', 'File content')
|
file_content = 'File content'
|
||||||
|
token = ajax_upload('myupload.txt', file_content)
|
||||||
|
|
||||||
assert_difference 'Issue.count' do
|
assert_difference 'Issue.count' do
|
||||||
post(
|
post(
|
||||||
@@ -84,7 +85,7 @@ class AttachmentsTest < Redmine::IntegrationTest
|
|||||||
attachment = issue.attachments.first
|
attachment = issue.attachments.first
|
||||||
assert_equal 'myupload.txt', attachment.filename
|
assert_equal 'myupload.txt', attachment.filename
|
||||||
assert_equal 'My uploaded file', attachment.description
|
assert_equal 'My uploaded file', attachment.description
|
||||||
assert_equal 'File content'.length, attachment.filesize
|
assert_equal file_content.length, attachment.filesize
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_upload_as_js_and_preview_as_inline_attachment
|
def test_upload_as_js_and_preview_as_inline_attachment
|
||||||
@@ -121,7 +122,8 @@ class AttachmentsTest < Redmine::IntegrationTest
|
|||||||
def test_upload_and_resubmit_after_validation_failure
|
def test_upload_and_resubmit_after_validation_failure
|
||||||
log_user('jsmith', 'jsmith')
|
log_user('jsmith', 'jsmith')
|
||||||
|
|
||||||
token = ajax_upload('myupload.txt', 'File content')
|
file_content = 'File content'
|
||||||
|
token = ajax_upload('myupload.txt', file_content)
|
||||||
|
|
||||||
assert_no_difference 'Issue.count' do
|
assert_no_difference 'Issue.count' do
|
||||||
post(
|
post(
|
||||||
@@ -167,13 +169,14 @@ class AttachmentsTest < Redmine::IntegrationTest
|
|||||||
attachment = issue.attachments.first
|
attachment = issue.attachments.first
|
||||||
assert_equal 'myupload.txt', attachment.filename
|
assert_equal 'myupload.txt', attachment.filename
|
||||||
assert_equal 'My uploaded file', attachment.description
|
assert_equal 'My uploaded file', attachment.description
|
||||||
assert_equal 'File content'.length, attachment.filesize
|
assert_equal file_content.length, attachment.filesize
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_upload_filename_with_plus
|
def test_upload_filename_with_plus
|
||||||
log_user('jsmith', 'jsmith')
|
log_user('jsmith', 'jsmith')
|
||||||
filename = 'a+b.txt'
|
filename = 'a+b.txt'
|
||||||
token = ajax_upload(filename, 'File content')
|
file_content = 'File content'
|
||||||
|
token = ajax_upload(filename, file_content)
|
||||||
assert_difference 'Issue.count' do
|
assert_difference 'Issue.count' do
|
||||||
post(
|
post(
|
||||||
'/projects/ecookbook/issues',
|
'/projects/ecookbook/issues',
|
||||||
@@ -191,7 +194,7 @@ class AttachmentsTest < Redmine::IntegrationTest
|
|||||||
attachment = issue.attachments.first
|
attachment = issue.attachments.first
|
||||||
assert_equal filename, attachment.filename
|
assert_equal filename, attachment.filename
|
||||||
assert_equal '', attachment.description
|
assert_equal '', attachment.description
|
||||||
assert_equal 'File content'.length, attachment.filesize
|
assert_equal file_content.length, attachment.filesize
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_upload_as_js_and_destroy
|
def test_upload_as_js_and_destroy
|
||||||
|
|||||||
Reference in New Issue
Block a user