alphagov/slimmer — pull request #106 by jamiecobbett (2014-12-22 15:29:22+00:00)
Title: Improve govuk components test behaviour

Using a script tag caused a few issues when used in an app:
* it isn't "visible" to Capybara, requiring overriding default behaviour for
Capybara matchers to work
* this meant that the app had to have more knowledge than it should about
Slimmer
* Slimmer automatically moves script tags to the end of the body tag, making it
impossible to test where the component was being included
* whilst it was less likely to be confused for real content, it still could be
confused for a real script tag

We did want to add tests to make sure that the arguments passed to the template - the `locals` - are escaped before being sent in the response, but because the ERB would be evaluated by Rails calling our `ComponentResolver`, it isn't evaluated, let alone escaped in them Gem. If we really wanted to test that it was escaped, we could use something like https://github.com/pat/combustion to have a dummy Rails app in the test suite.