Skip to content

Instantly share code, notes, and snippets.

@febuiles
Created August 11, 2008 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save febuiles/4895 to your computer and use it in GitHub Desktop.
Save febuiles/4895 to your computer and use it in GitHub Desktop.
From 5271bdc0b88c3e4c2c21d7b59885421886760dc8 Mon Sep 17 00:00:00 2001
From: Federico Builes <federico.builes@gmail.com>
Date: Mon, 11 Aug 2008 12:14:31 -0500
Subject: [PATCH] Making sure that Kernel#require specs use /tmp for touching files.
---
1.8/core/kernel/require_spec.rb | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/1.8/core/kernel/require_spec.rb b/1.8/core/kernel/require_spec.rb
index f119037..fb17d17 100644
--- a/1.8/core/kernel/require_spec.rb
+++ b/1.8/core/kernel/require_spec.rb
@@ -1,7 +1,9 @@
require File.dirname(__FILE__) + '/../../spec_helper'
$require_fixture_dir = (File.dirname(__FILE__) + '/../../fixtures/require')
+$require_tmp_dir = tmp("require_specs")
$LOAD_PATH << $require_fixture_dir
+$LOAD_PATH << $require_tmp_dir
$require_spec = nil
$require_spec_1 = nil
@@ -30,13 +32,20 @@ describe "Kernel#require" do
# Avoid storing .rbc in repo
before :all do
- Dir.chdir($require_fixture_dir) {
- `rm -f ./*.rbc`
+ Dir.mkdir($require_tmp_dir)
+ Dir.chdir($require_tmp_dir) {
`touch require_spec_dummy.#{Config::CONFIG['DLEXT']}`
`touch require_spec_dummy.rb`
}
end
+ after :all do
+ Dir.chdir($require_tmp_dir) {
+ `rm *`
+ }
+ Dir.rmdir $require_tmp_dir
+ end
+
# The files used below just contain code that assigns
# Time.now to the respective global variable so that
# reloads can easily be verified.
--
1.5.6.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment