@@ -227,6 +227,13 class Issue < ActiveRecord::Base | |||||
227 | @custom_field_values = nil |
|
227 | @custom_field_values = nil | |
228 | result |
|
228 | result | |
229 | end |
|
229 | end | |
|
230 | ||||
|
231 | def description=(arg) | |||
|
232 | if arg.is_a?(String) | |||
|
233 | arg = arg.gsub(/(\r\n|\n|\r)/, "\r\n") | |||
|
234 | end | |||
|
235 | write_attribute(:description, arg) | |||
|
236 | end | |||
230 |
|
237 | |||
231 | # Overrides attributes= so that tracker_id gets assigned first |
|
238 | # Overrides attributes= so that tracker_id gets assigned first | |
232 | def attributes_with_tracker_first=(new_attributes, *args) |
|
239 | def attributes_with_tracker_first=(new_attributes, *args) |
@@ -738,7 +738,7 class IssueTest < ActiveSupport::TestCase | |||||
738 | IssueCustomField.delete_all |
|
738 | IssueCustomField.delete_all | |
739 | Issue.update_all("description = NULL", "id=1") |
|
739 | Issue.update_all("description = NULL", "id=1") | |
740 |
|
740 | |||
741 |
i = Issue.fi |
|
741 | i = Issue.find(1) | |
742 | i.init_journal(User.find(2)) |
|
742 | i.init_journal(User.find(2)) | |
743 | i.subject = "blank description" |
|
743 | i.subject = "blank description" | |
744 | i.description = "\r\n" |
|
744 | i.description = "\r\n" | |
@@ -749,6 +749,11 class IssueTest < ActiveSupport::TestCase | |||||
749 | end |
|
749 | end | |
750 | end |
|
750 | end | |
751 | end |
|
751 | end | |
|
752 | ||||
|
753 | def test_description_eol_should_be_normalized | |||
|
754 | i = Issue.new(:description => "CR \r LF \n CRLF \r\n") | |||
|
755 | assert_equal "CR \r\n LF \r\n CRLF \r\n", i.description | |||
|
756 | end | |||
752 |
|
757 | |||
753 | def test_saving_twice_should_not_duplicate_journal_details |
|
758 | def test_saving_twice_should_not_duplicate_journal_details | |
754 | i = Issue.find(:first) |
|
759 | i = Issue.find(:first) |
General Comments 0
You need to be logged in to leave comments.
Login now