diff options
| author | Alyssa Ross | 2016-09-19 23:00:58 +0100 |
|---|---|---|
| committer | Alyssa Ross | 2016-09-19 23:00:58 +0100 |
| commit | d3740ec34f1ad98311a3ac606643db972d5130e9 (patch) | |
| tree | 57744f34aba64f88941ab97d040034af391637e6 /Library/Homebrew/test/test_inreplace.rb | |
| parent | e22610aedd550cb5577dd08cedb7a5609d0ff0b8 (diff) | |
| download | brew-d3740ec34f1ad98311a3ac606643db972d5130e9.tar.bz2 | |
tests: run in parallel
Diffstat (limited to 'Library/Homebrew/test/test_inreplace.rb')
| -rw-r--r-- | Library/Homebrew/test/test_inreplace.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Library/Homebrew/test/test_inreplace.rb b/Library/Homebrew/test/test_inreplace.rb index 91d57f942..0e62f9d3f 100644 --- a/Library/Homebrew/test/test_inreplace.rb +++ b/Library/Homebrew/test/test_inreplace.rb @@ -91,26 +91,29 @@ class InreplaceTest < Homebrew::TestCase end def test_inreplace_errors + require "tempfile" extend(Utils::Inreplace) - open("test", "w") { |f| f.write "a\nb\nc\n" } + file = Tempfile.new("test") + + file.write "a\nb\nc\n" assert_raises(Utils::InreplaceError) do - inreplace "test", "d", "f" + inreplace file.path, "d", "f" end assert_raises(Utils::InreplaceError) do # Under current context, we are testing `String#gsub!`, so let's disable rubocop temporarily. - inreplace("test") { |s| s.gsub!("d", "f") } # rubocop:disable Performance/StringReplacement + inreplace(file.path) { |s| s.gsub!("d", "f") } # rubocop:disable Performance/StringReplacement end assert_raises(Utils::InreplaceError) do - inreplace("test") do |s| + inreplace(file.path) do |s| s.change_make_var! "VAR", "value" s.remove_make_var! "VAR2" end end ensure - File.unlink("test") + file.unlink end end |
