Skip to content

Commit

Permalink
Fixed broken test with frozen objects
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Jun 20, 2017
1 parent 68ef914 commit 23f779f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/rake/ext/string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def pathmap_replace(patterns, &block)
# This String extension comes from Rake
def pathmap(spec=nil, &block)
return self if spec.nil?
result = ""
result = "".dup
spec.scan(/%\{[^}]*\}-?\d*[sdpfnxX%]|%-?\d+d|%.|[^%]+/) do |frag|
case frag
when "%f"
Expand Down
2 changes: 1 addition & 1 deletion lib/rake/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def set_arg_names(args)
# Return a string describing the internal state of a task. Useful for
# debugging.
def investigation
result = "------------------------------\n"
result = "------------------------------\n".dup
result << "Investigating #{name}\n"
result << "class: #{self.class}\n"
result << "task needed: #{needed?}\n"
Expand Down
2 changes: 1 addition & 1 deletion test/test_rake_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_display_exception_details

def test_display_exception_details_bad_encoding
begin
raise "El Niño is coming!".force_encoding("US-ASCII")
raise "El Niño is coming!".dup.force_encoding("US-ASCII")
rescue => ex
end

Expand Down
2 changes: 1 addition & 1 deletion test/test_rake_path_map_partial.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class TestRakePathMapPartial < Rake::TestCase
def test_pathmap_partial
@path = "1/2/file"
@path = "1/2/file".dup
def @path.call(n)
pathmap_partial(n)
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_trace_output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class PrintSpy
attr_reader :result, :calls

def initialize
@result = ""
@result = "".dup
@calls = 0
end

Expand Down

0 comments on commit 23f779f

Please sign in to comment.