ApprovalTests.Ruby
ApprovalTests.Ruby copied to clipboard
Redifine match behaviour for filters?
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.
Agreed.