diff options
author | Louise Crow <louise.crow@gmail.com> | 2014-01-17 10:49:29 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-01-17 10:49:29 +0000 |
commit | a6b40e039aca35e011e9e106f6a791ffa4b555db (patch) | |
tree | 65680fac1ca5630ac00df6cd5e7cf4a8bfaa8cc6 /spec/spec_helper.rb | |
parent | 09a7180b3f5ddbed54da23a6985fff196cc36af2 (diff) |
Tighten up expectation, make expected files consistent.
Just expecting the parsed file to include the expected one would mean
success in the case where nothing has been folded. Tighten up the
expectation, and add quoting placeholders to expected files that didn't
have them.
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r-- | spec/spec_helper.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 52752dca5..dc5a0d6eb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -220,3 +220,16 @@ Spork.each_run do FactoryGirl.reload # This code will be run each time you run your specs. end + +def normalise_whitespace(s) + s = s.gsub(/\A\s+|\s+\Z/, "") + s = s.gsub(/\s+/, " ") + return s +end + +RSpec::Matchers.define :be_equal_modulo_whitespace_to do |expected| + match do |actual| + normalise_whitespace(actual) == normalise_whitespace(expected) + end +end + |