diff options
| author | Teddy Wing | 2017-06-08 18:33:03 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-06-08 18:33:03 +0200 |
| commit | 89a81c459b60391603f38cb1a477e883d3bb2403 (patch) | |
| tree | 2a331afe20ba2f1c3faed761a483e29584fbae39 | |
| parent | 3b745cf43b877a4bb26532d16b602717779cf15c (diff) | |
| download | chouette-core-89a81c459b60391603f38cb1a477e883d3bb2403.tar.bz2 | |
TableBuilder spec: Use 'htmlbeautifier' gem for beautifying
Instead of `REXML::Document`, use `htmlbeautifier` to beautify our
actual HTML result. The trouble with `REXML` was that it forced single
quotes around attribute values. With 'htmlbeautifier', we get a good
result that we can realistically use for line-by-line diffs between
expected and actual. Much easier see what went wrong this way. And, in
my current case, see what I need to update update in the expected string
based on the factory-generated objects that I'm using.
Refs #3479
| -rw-r--r-- | spec/helpers/table_builder_helper_spec.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/spec/helpers/table_builder_helper_spec.rb b/spec/helpers/table_builder_helper_spec.rb index 5945b0f82..c94df36a5 100644 --- a/spec/helpers/table_builder_helper_spec.rb +++ b/spec/helpers/table_builder_helper_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' +require 'htmlbeautifier' module TableBuilderHelper include Pundit @@ -123,8 +124,8 @@ describe TableBuilderHelper, type: :helper do links: [:show, :edit, :archive, :unarchive, :delete], cls: 'table has-filter has-search' ) - beautified_html = '' - REXML::Document.new(html_str).write(beautified_html, 4) + + beautified_html = HtmlBeautifier.beautify(html_str, indent: ' ') expect(beautified_html).to eq(expected) end |
