Skip to content

Instantly share code, notes, and snippets.

@dstnbrkr
Created October 16, 2009 02:27
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 dstnbrkr/211485 to your computer and use it in GitHub Desktop.
Save dstnbrkr/211485 to your computer and use it in GitHub Desktop.
From 0be864d8f6eac17afb245b44020e53b932412770 Mon Sep 17 00:00:00 2001
From: Dustin Barker <dustin.barker@gmail.com>
Date: Thu, 15 Oct 2009 19:24:08 -0700
Subject: [PATCH] If a mock dir exists and is a symlink, resolve it.
Fixes specs that fail on Mac OS X due to symlink /var -> /private/var
---
core/dir/fixtures/common.rb | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/core/dir/fixtures/common.rb b/core/dir/fixtures/common.rb
index 3ae640d..e1939f1 100644
--- a/core/dir/fixtures/common.rb
+++ b/core/dir/fixtures/common.rb
@@ -1,8 +1,10 @@
require 'fileutils'
+require 'pathname'
module DirSpecs
def DirSpecs.mock_dir(dirs = ['mock'])
- File.expand_path(tmp(File.join(dirs)))
+ dir = File.expand_path(tmp(File.join(dirs)))
+ File.exists?(dir) ? Pathname.new(dir).realpath.to_s : dir
end
def DirSpecs.nonexistent
--
1.6.4.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment