Skip to content

Commit

Permalink
Merge pull request padrino#1328 from Ortuna/link-mail-escape
Browse files Browse the repository at this point in the history
Added test cases for padrino#1188
  • Loading branch information
Arthur Chiu committed Jul 2, 2013
2 parents c409e42 + c65aafe commit 0c1317b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions padrino-helpers/test/test_asset_tag_helpers.rb
Expand Up @@ -71,9 +71,9 @@ def flash
end

should "escape the link text" do
actual_link = link_to('/register', :class => 'first', :id => 'binky') { "<>" }
actual_link = link_to('/register', :class => 'first', :id => 'binky') { "<&>" }
assert_has_tag('a#binky.first', :href => '/register') { actual_link }
assert_match "&lt;&gt;", actual_link
assert_match "&lt;&amp;&gt;", actual_link
end

should "not escape image_tag" do
Expand Down Expand Up @@ -119,6 +119,12 @@ def flash
assert_match %r{subject\=demo\%20test}, actual_html
end

should "escape & with encoded string and &amp; in HTML" do
actual_html = mail_to('test@demo.com', "My&Email", :subject => "this&that")
assert_match 'this%26that', actual_html
assert_match 'My&amp;Email', actual_html
end

should "display mail link element in haml" do
visit '/haml/mail_to'
assert_have_selector 'p.simple a', :href => 'mailto:test@demo.com', :content => 'test@demo.com'
Expand Down

0 comments on commit 0c1317b

Please sign in to comment.