github / scientist

:microscope: A Ruby library for carefully refactoring critical paths.
MIT License
7.47k stars 442 forks source link

Do not use `String#prepend`, as it modifies the string. #99

Closed arthurschreiber closed 5 years ago

arthurschreiber commented 5 years ago

I just ran into this. If #inspect on a candidate or control value returns a frozen string, the format_observation method blows up. 💥

In general, it's just good form not to modify values in-place that we didn't create ourselves. 🤷‍♂️

arthurschreiber commented 5 years ago

I just now noticed this fixes the same issue as #96 and #94.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 99.083% when pulling a1a75ea14322d87702af7740fccfc8d77d47fb98 on arthur/do-not-use-prepend into ab16d6c957c9128c6ab76c5b0fe1fc599db1024f on master.

zerowidth commented 5 years ago

This is fixed as of #96. I can cut a new release if y'all would like.

zerowidth commented 5 years ago

Fixed and released.