Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmp: accept frozen strings #69

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/mspec/helpers/tmp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end
SPEC_TEMP_DIR = spec_temp_dir

SPEC_TEMP_UNIQUIFIER = "0"
SPEC_TEMP_UNIQUIFIER = +"0"

at_exit do
begin
Expand Down Expand Up @@ -41,6 +41,7 @@ def tmp(name, uniquify = true)
if uniquify and !name.empty?
slash = name.rindex "/"
index = slash ? slash + 1 : 0
name = +name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think .dup might be nicer here, because then this method simply never mutates the argument, which feels cleaner, could you switch to that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see + is more compatible and in fact current ruby/spec passes with this change.
Let's merge as-is then and maybe clean this up later.

name.insert index, "#{SPEC_TEMP_UNIQUIFIER.succ!}-"
end

Expand Down