assert-value / assert_value_ruby

MIT License
6 stars 3 forks source link

`--no-canonicalize` does not seem to work in rspec #7

Open weshatheleopard opened 1 year ago

weshatheleopard commented 1 year ago

Looks like respective branches only fire in new minitest, old minitest and test_unit, but not in rspec.

smetana commented 1 year ago

Hi. Thank you for report. We'll take a look at the issue

weshatheleopard commented 1 year ago

The situation that brought this issue into existance is that we utilize rspec, and we are using assert_value to compare an HTML file produced by the code with a sample HTML file. Whenever a special HTML character was encoded in the said HTML file (for example, {), everything else on that line would be stripped by the canonicalizer (because of #). As a result, if something important has changed in the produced HTML beyond that character, assert-value would fail to notice the discrepancy. Learned it the hard way.

What we would like: a) capability to disable canonicalization when using rspec (as specified above, right now such capability is completely missing). b) capability to do so through the code (like, spec_helper.rb, etc/intializers/assert_value.rb or the like) instead of through the commandline option.

smetana commented 1 year ago

We agree with your analysis. We probably will not have time to work on this in the immediate future. PR would be welcomed if you want to work on this.

weshatheleopard commented 1 year ago

The reason I brought this to your attention is because there are multiple possible ways to accomplish that (like, how whether to have a global configuration variable set by spec_helper, an initializer, etc, etc, and I wanted to let you choose the exact path. If you are giving that choice to me, I can certainly do that.

smetana commented 1 year ago

Yes please. It will make sense to have two PRs.

One for RSpec support. Will need to make sure it passes tests in different ruby versions (see test matrix).

And one for controlling canonicalization. This may require more discussion, but ideally we should do that after you have a PR with approach you like best.