Skip to content

Commit

Permalink
Merge pull request #367 from raphinesse/ntfs-issue
Browse files Browse the repository at this point in the history
Fix supposedly NTFS-related "races" for the `tmp` directory
  • Loading branch information
denisdefreyne committed Dec 4, 2013
2 parents 650ab5b + bdedccc commit 96bffcb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion test/base/test_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_context_with_instance_method

def test_example
# Parse
YARD.parse('../lib/nanoc/base/context.rb')
YARD.parse(LIB_DIR + '/nanoc/base/context.rb')

# Run
assert_examples_correct 'Nanoc::Context#initialize'
Expand Down
2 changes: 1 addition & 1 deletion test/base/test_directed_graph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def test_roots_after_removing_edge
end

def test_example
YARD.parse('../lib/nanoc/base/directed_graph.rb')
YARD.parse(LIB_DIR + '/nanoc/base/directed_graph.rb')
assert_examples_correct 'Nanoc::DirectedGraph'
end

Expand Down
9 changes: 6 additions & 3 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
require 'nanoc/tasks'

# Load miscellaneous requirements
require 'tmpdir'
require 'stringio'

module Nanoc::TestHelpers

LIB_DIR = File.expand_path(File.dirname(__FILE__) + '/../lib')

def if_have(*libs)
libs.each do |lib|
begin
Expand Down Expand Up @@ -121,9 +124,9 @@ def setup
end

# Enter tmp
FileUtils.mkdir_p('tmp')
@tmp_dir = Dir.mktmpdir('nanoc-test')
@orig_wd = FileUtils.pwd
FileUtils.cd('tmp')
FileUtils.cd(@tmp_dir)

# Let us get to the raw errors
Nanoc::CLI::ErrorHandler.disable
Expand All @@ -135,7 +138,7 @@ def teardown

# Exit tmp
FileUtils.cd(@orig_wd)
FileUtils.rm_rf('tmp')
FileUtils.rm_rf(@tmp_dir)

# Go unquiet
unless ENV['QUIET'] == 'false'
Expand Down
6 changes: 3 additions & 3 deletions test/helpers/test_link_to.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def test_relative_path_to_to_windows_path

def test_examples_link_to
# Parse
YARD.parse('../lib/nanoc/helpers/link_to.rb')
YARD.parse(LIB_DIR + '/nanoc/helpers/link_to.rb')

# Mock
@items = [ mock, mock, mock ]
Expand All @@ -227,7 +227,7 @@ def test_examples_link_to

def test_examples_link_to_unless_current
# Parse
YARD.parse('../lib/nanoc/helpers/link_to.rb')
YARD.parse(LIB_DIR + '/nanoc/helpers/link_to.rb')

# Mock
@item_rep = mock
Expand All @@ -241,7 +241,7 @@ def test_examples_link_to_unless_current

def test_examples_relative_path_to
# Parse
YARD.parse('../lib/nanoc/helpers/link_to.rb')
YARD.parse(LIB_DIR + '/nanoc/helpers/link_to.rb')

# Mock
@item_rep = mock
Expand Down

0 comments on commit 96bffcb

Please sign in to comment.