From b8f8f4e4922b88bb5d1641e727c96f606e54669a Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 13 Mar 2024 18:30:53 +0100 Subject: [PATCH] tmp: accept frozen strings Ref: https://github.com/ruby/ruby/pull/10235 As discussed upstream, the mutability is only used in one spec, `path.rb`: ```ruby @name = +"file_to_path" @path = tmp(@name) ``` For all the others it doesn't matter if the argument is mutated or not. --- lib/mspec/helpers/tmp.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/mspec/helpers/tmp.rb b/lib/mspec/helpers/tmp.rb index b2a38ee9..4c0eddab 100644 --- a/lib/mspec/helpers/tmp.rb +++ b/lib/mspec/helpers/tmp.rb @@ -12,7 +12,7 @@ end SPEC_TEMP_DIR = spec_temp_dir -SPEC_TEMP_UNIQUIFIER = "0" +SPEC_TEMP_UNIQUIFIER = +"0" at_exit do begin @@ -41,6 +41,7 @@ def tmp(name, uniquify = true) if uniquify and !name.empty? slash = name.rindex "/" index = slash ? slash + 1 : 0 + name = +name name.insert index, "#{SPEC_TEMP_UNIQUIFIER.succ!}-" end