Skip to content

Commit 23f779f

Browse files
committed
Fixed broken test with frozen objects
1 parent 68ef914 commit 23f779f

5 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/rake/ext/string.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def pathmap_replace(patterns, &block)
137137
# This String extension comes from Rake
138138
def pathmap(spec=nil, &block)
139139
return self if spec.nil?
140-
result = ""
140+
result = "".dup
141141
spec.scan(/%\{[^}]*\}-?\d*[sdpfnxX%]|%-?\d+d|%.|[^%]+/) do |frag|
142142
case frag
143143
when "%f"

lib/rake/task.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def set_arg_names(args)
321321
# Return a string describing the internal state of a task. Useful for
322322
# debugging.
323323
def investigation
324-
result = "------------------------------\n"
324+
result = "------------------------------\n".dup
325325
result << "Investigating #{name}\n"
326326
result << "class: #{self.class}\n"
327327
result << "task needed: #{needed?}\n"

test/test_rake_application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_display_exception_details
3737

3838
def test_display_exception_details_bad_encoding
3939
begin
40-
raise "El Niño is coming!".force_encoding("US-ASCII")
40+
raise "El Niño is coming!".dup.force_encoding("US-ASCII")
4141
rescue => ex
4242
end
4343

test/test_rake_path_map_partial.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class TestRakePathMapPartial < Rake::TestCase
55
def test_pathmap_partial
6-
@path = "1/2/file"
6+
@path = "1/2/file".dup
77
def @path.call(n)
88
pathmap_partial(n)
99
end

test/test_trace_output.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class PrintSpy
99
attr_reader :result, :calls
1010

1111
def initialize
12-
@result = ""
12+
@result = "".dup
1313
@calls = 0
1414
end
1515

0 commit comments

Comments
 (0)