Skip to content

Commit

Permalink
Truncate method names further in system tests (#2058)
Browse files Browse the repository at this point in the history
* Truncate method names further in system tests

ref: https://github.com/rspec/rspec-rails/pull/1999/files

If system test fails, a screenshot is taken, but if the file name exceeds 255 characters(e.g. using turnip), the following error will be output.

```
File name too long @ rb_sysopen
```

The file name is prepended with `failures_` so further truncation is needed.
  • Loading branch information
tkm-kj authored and benoittgt committed Jan 13, 2019
1 parent 7cc0166 commit 85b16c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rspec/rails/example/system_example_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def method_name
@method_name ||= [
self.class.name.underscore,
RSpec.current_example.description.underscore
].join("_").tr(CHARS_TO_TRANSLATE.join, "_")[0...251] + "_#{rand(1000)}"
].join("_").tr(CHARS_TO_TRANSLATE.join, "_")[0...200] + "_#{rand(1000)}"
end

# Delegates to `Rails.application`.
Expand Down

0 comments on commit 85b16c4

Please sign in to comment.