diff --git a/app/models/observer/ticket/notification/background_job.rb b/app/models/observer/ticket/notification/background_job.rb
index afc088a78..53a56e9e2 100644
--- a/app/models/observer/ticket/notification/background_job.rb
+++ b/app/models/observer/ticket/notification/background_job.rb
@@ -215,6 +215,7 @@ class Observer::Ticket::Notification::BackgroundJob
#{article.body.text2html}
</snip>
+
'
end
@@ -280,6 +281,7 @@ State: i18n(#{ticket.state.name.text2html})
#{article.body.text2html}
</snip>
+
'
end
if user.preferences[:locale] =~ /^de/i
diff --git a/lib/core_ext/string.rb b/lib/core_ext/string.rb
index f88fddbba..72d6241c4 100644
--- a/lib/core_ext/string.rb
+++ b/lib/core_ext/string.rb
@@ -19,8 +19,18 @@ class String
line.length > options[:line_width] ? line.gsub(/(.{1,#{options[:line_width]}})(\s+|$)/, "\\1\n").strip : line
end * "\n"
end
+
+=begin
+
+ filename = 'Some::Module'.to_filename
+
+ returns
+ 'some/module'
+
+=end
+
def to_filename
- camel_cased_word = self.to_s
+ camel_cased_word = "#{self}"
camel_cased_word.gsub(/::/, '/').downcase
end
@@ -43,10 +53,14 @@ class String
text = html_string.html2text
+ returns
+
+ 'string with text'
+
=end
def html2text
- string = self
+ string = "#{self}"
# in case of invalid encodeing, strip invalid chars
# see also test/fixtures/mail21.box
diff --git a/test/unit/aaa_string_parser_test.rb b/test/unit/aaa_string_parser_test.rb
new file mode 100644
index 000000000..9761f2107
--- /dev/null
+++ b/test/unit/aaa_string_parser_test.rb
@@ -0,0 +1,129 @@
+# encoding: utf-8
+require 'test_helper'
+
+class AaaStringTest < ActiveSupport::TestCase
+
+ test 'to_filename ref' do
+ modul = 'test'
+ result = 'test'
+ modul.to_filename
+ assert_equal( result, modul )
+
+ modul = 'Some::File'
+ result = 'Some::File'
+ modul.to_filename
+ assert_equal( result, modul )
+ end
+
+ test 'to_filename function' do
+ modul = 'test'
+ result = 'test'
+ assert_equal( result, modul.to_filename )
+
+ modul = 'Some::File'
+ result = 'some/file'
+ assert_equal( result, modul.to_filename )
+ end
+
+ test 'html2text ref' do
+ html = 'test'
+ result = 'test'
+ html.html2text
+ assert_equal( result, html )
+
+ html = '
"
+ result = "[1] Best Tool of the Worldsome other text\n\n\n[1] http://zammad.org"
+ assert_equal( result, html.html2text )
+
+ html = "
+
+ test
\n
\n
\n
+ "
+ result = "test\n\n___"
+ assert_equal( result, html.html2text )
+
+ html = ' line 1
+you
+-----&'
+ should = 'line 1
+you
+-----&'
+ assert_equal( should, html.html2text )
+
+
+ html = '
'
+ should = '* #1
+* #2'
+ assert_equal( should, html.html2text )
+
+ html = '
+
+
+
+
+
+
> Welcome!
>
> Thank you for installing Zammad.
>
+
+'
+ should = '> Welcome!
+>
+> Thank you for installing Zammad.
+>'
+ assert_equal( should, html.html2text )
+
+ end
+end
\ No newline at end of file
diff --git a/test/unit/email_build_test.rb b/test/unit/email_build_test.rb
index dfd775612..7f7764d7b 100644
--- a/test/unit/email_build_test.rb
+++ b/test/unit/email_build_test.rb
@@ -163,93 +163,4 @@ class EmailBuildTest < ActiveSupport::TestCase
end
- test 'html2text' do
-
- html = 'test'
- result = 'test'
- assert_equal( result, html.html2text )
-
- html = ' test '
- result = 'test'
- assert_equal( result, html.html2text )
-
- html = "\n\n test \n\n\n"
- result = 'test'
- assert_equal( result, html.html2text )
-
- html = '
test
'
- result = 'test'
- assert_equal( result, html.html2text )
-
- html = '
test
'
- result = 'test'
- assert_equal( result, html.html2text )
-
- html = "
test
\n
\n
\n
"
- result = 'test'
- assert_equal( result, html.html2text )
-
- html = "
test\n\ntest
"
- result = "test\ntest"
- assert_equal( result, html.html2text )
-
- html = "
test\n\ntest
"
- result = "test\ntest"
- assert_equal( result, html.html2text )
-
- html = "
"
- result = "test col \ntest 4711"
- assert_equal( result, html.html2text )
-
-
- html = "
-
- test
\n
\n
\n
-
"
- result = 'test'
- assert_equal( result, html.html2text )
-
- html = "\n
-
"
- result = "[1] Best Tool of the Worldsome other text\n\n\n[1] http://zammad.org"
- assert_equal( result, html.html2text )
-
- html = "
-
- test
\n
\n
\n
- "
- result = "test\n\n___"
- assert_equal( result, html.html2text )
-
- html = ' line 1
-you
------&'
- should = 'line 1
-you
------&'
- assert_equal( should, html.html2text )
-
-
- html = '
'
- should = '* #1
-* #2'
- assert_equal( should, html.html2text )
-
- html = '
-
-
-
-
-
-
> Welcome!
>
> Thank you for installing Zammad.
>
-
-'
- should = '> Welcome!
->
-> Thank you for installing Zammad.
->'
- assert_equal( should, html.html2text )
-
- end
end
\ No newline at end of file