ApprovalTests.Ruby icon indicating copy to clipboard operation
ApprovalTests.Ruby copied to clipboard

Redifine match behaviour for filters?

Open markijbema opened this issue 11 years ago • 1 comments

I wonder why the choice was made to make a filter match regularly, instead of requiring it to match the whole string. Compare:

filters = {
  time: /^time$/,
  id: /(^|_)id$/,
  timestamp: /_at$/
}

versus

filters = {
  time: /time/,
  id: /(.*_)?id/,
  timestamp: /.*_at/
}

Imo the latter describe much clearer the content of the string matched, whereas the former sound more cryptical, and is easier to make mistakes with, like http://rubular.com/r/EnyxkU60Jo

Therefore I would be in favour of doing all-string matches always.

markijbema avatar Feb 19 '14 19:02 markijbema

Agreed.

kytrinyx avatar Feb 19 '14 20:02 kytrinyx