diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/helpers/application_helper_test.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 500fbd86e..678dcfda5 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -383,12 +383,25 @@ RAW # invalid expressions 'source:' => 'source:', # url hash - "http://foo.bar/FAQ#3" => '<a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a>', + "http://foo.bar/FAQ#3" => '<a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a>', + # user + 'user:jsmith' => link_to_user(User.find_by_id(2)), + '@jsmith' => link_to_user(User.find_by_id(2)), + # invalid user + 'user:foobar' => 'user:foobar', } @project = Project.find(1) to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text), "#{text} failed" } end + def test_user_links_with_email_as_login_name_should_not_be_parsed + u = User.generate!(:login => 'jsmith@somenet.foo') + raw = "@jsmith@somenet.foo should not be parsed in jsmith@somenet.foo" + + assert_match %r{<p><a class="user active".*>#{u.name}</a> should not be parsed in <a class="email" href="mailto:jsmith@somenet.foo">jsmith@somenet.foo</a></p>}, + textilizable(raw, :project => Project.find(1)) + end + def test_should_not_parse_redmine_links_inside_link raw = "r1 should not be parsed in http://example.com/url-r1/" assert_match %r{<p><a class="changeset".*>r1</a> should not be parsed in <a class="external" href="http://example.com/url-r1/">http://example.com/url-r1/</a></p>}, |