In the latter, if you open it in the debugger, and print out page.body, you get Ha! <script type='text/javascript'>alert('hello!');</script>
Hence I test with
within("#team-name h2") do
page.should have_content("Ha! <script type='text/javascript'>alert('hello!');</script>")
end
Clean the output from the server, if there has been malicious user input.
One problem found:
<script type="text/javascript">alert("hello!");</script>
into input boxes, breaks the site.List of things to sanitize:
Notes on testing
In tests with
<%= @team.name %>
returns"Ha! alert('hello!');"
<%= h @team.name %>
returns"Ha! <script type='text/javascript'>alert('hello!');</script>"
In the latter, if you open it in the debugger, and print out
page.body
, you getHa! <script type='text/javascript'>alert('hello!');</script>
Hence I test with
Resources