mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
3c3b80eb96
When a test method name includes a slash (e.g. `test "signup on the /signup page"`) the screenshot is generated in the nested directory on systems that use slash as a directory separator (e.g. a screenshot called `signup_page.png` is generated within `failures_signup_on_the_`). Nesting screenshots causes an issue with `tmp:clear` rake task: ``` == Removing old logs and tempfiles == rails aborted! Errno::EISDIR: Is a directory @ apply2files - tmp/screenshots/failures_signup_on_the_ /var/lib/gems/2.5.0/gems/railties-5.2.3/lib/rails/tasks/tmp.rake:41:in `block (3 levels) in <top (required)>' /var/lib/gems/2.5.0/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:23:in `block in perform' ... Tasks: TOP => tmp:clear => tmp:screenshots:clear ``` While the error could be prevented by changing `tmp:clear` task, there's no reason to generate deep directory structures for tests using slashes. To prevent a similar problem on Windows, we'll also "sanitize" backslashes. Replacing the problamatic characters with dashes seems to be a safe workaround, although dash is very arbitrary choice in this case. Co-Authored-By: Louis-Michel Couture <louim_1@hotmail.com> |
||
---|---|---|
.. | ||
screenshot_helper.rb | ||
setup_and_teardown.rb |