Skip to content

Commit fa5a3ed

Browse files
committed
Consider the multibyte value in the method name of system test
`String#[]` returns a value that considers multibyte value. But maximum filename length use bytes. So if applications use multibyte value to a method name, currently check doesn't work expected. This PR fixes to use `String#byteslice` instead of `String#[]`. Also, added `String#scrub` to avoid generating an invalid byte sequence.
1 parent 934276b commit fa5a3ed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rspec/rails/example/system_example_group.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def method_name
4141
@method_name ||= [
4242
self.class.name.underscore,
4343
RSpec.current_example.description.underscore
44-
].join("_").tr(CHARS_TO_TRANSLATE.join, "_")[0...200] + "_#{rand(1000)}"
44+
].join("_").tr(CHARS_TO_TRANSLATE.join, "_").byteslice(0...200).scrub("") + "_#{rand(1000)}"
4545
end
4646

4747
# Delegates to `Rails.application`.

0 commit comments

Comments
 (0)