gollum/gollum-lib — pull request #95 by dometto (2014-09-05 15:07:21+00:00)
Title: Better html_equal tests

The tests in `test_markup.rb` are currently unnecessarily complicated, defining expected results as hardcoded html with all spaces removed. This actually gets in the way of proper html equality testing. For instance:

```ruby
output = %{

ab

}
```
...would incorrectly come out as **not** html-equal to
```html

ab

```
...because nokogiri parses it as a `` tag instead of an `` tag. Also, e.g. `"Hackme"` was being considered html-equal to `"Hack me"`.

Presumably the rationale for removing all spaces from the expected output is spurious whitespace between tags will be ignored. However, nokogiri-diff already takes care of this.

This PR
* puts all the spaces back in the definitions of expected html in `test_markup.rb`
* modifies `html_equal` so that only the text content of tags is stripped of spurious whitespace (spaces and newlines **between** tags are already handled by nokogiri-diff)

Apart from (hopefully) improving readability, this will make it more easy to adequately provide tests for alternative/additional rendering gems (e.g. kramdown). Please take a look and let me know whether I have overlooked any reason for the whitespaceless status quo.