From 7c57c7e04b94d495fd86ec544d1b82a4f94ac771 Mon Sep 17 00:00:00 2001 From: Takumi Kaji Date: Sat, 29 Dec 2018 18:46:37 +0900 Subject: [PATCH 1/2] Truncate more method names 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 reason is the test fails, `failures_` is appended to first of file name. So I truncated it to a certain length so that the length of the file name does not become long. --- lib/rspec/rails/example/system_example_group.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rspec/rails/example/system_example_group.rb b/lib/rspec/rails/example/system_example_group.rb index ba8b5cb7b3..8518e70540 100644 --- a/lib/rspec/rails/example/system_example_group.rb +++ b/lib/rspec/rails/example/system_example_group.rb @@ -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...100] + "_#{rand(1000)}" end # Delegates to `Rails.application`. From 69012c219c6c8aae1f0029edfd1328f9cff0256e Mon Sep 17 00:00:00 2001 From: Takumi Kaji Date: Sun, 30 Dec 2018 21:52:57 +0900 Subject: [PATCH 2/2] Truncate to 200 characters ref: https://github.com/rspec/rspec-rails/pull/2058#discussion_r244531956 --- lib/rspec/rails/example/system_example_group.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rspec/rails/example/system_example_group.rb b/lib/rspec/rails/example/system_example_group.rb index 8518e70540..e63afeec8f 100644 --- a/lib/rspec/rails/example/system_example_group.rb +++ b/lib/rspec/rails/example/system_example_group.rb @@ -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...100] + "_#{rand(1000)}" + ].join("_").tr(CHARS_TO_TRANSLATE.join, "_")[0...200] + "_#{rand(1000)}" end # Delegates to `Rails.application`.