Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

made base glob dir more specific

sped up gem_eval_test
  • Loading branch information...
commit bafaaf3b71faf8204b794a36fe7a46bec31d8985 1 parent 5049bd8
coderrr coderrr authored
Showing with 14 additions and 5 deletions.
  1. +10 −1 gem_eval_test.rb
  2. +1 −1  lazy_dir.rb
  3. +3 −3 lazy_dir_test.rb
11 gem_eval_test.rb
View
@@ -11,7 +11,16 @@ class GemEvalTest < Test::Unit::TestCase
def setup
system("mv git_mock git")
@pid = fork { exec("PATH=.:$PATH ruby gem_eval.rb #{' > /dev/null 2>&1' unless OUTPUT}") }
- sleep 0.5
+
+ # wait for server to start
+ Timeout::timeout(3) do
+ begin
+ TCPSocket.open('localhost', 4567){}
+ server_started = true
+ rescue Errno::ECONNREFUSED
+ server_started = false
+ end until server_started
+ end
end
def teardown
2  lazy_dir.rb
View
@@ -11,7 +11,7 @@ def to_a
files = OrigDir.send(@method, *@args, &@block)
# only return files within the current directory
- cur_dir = File.expand_path('.')
+ cur_dir = File.expand_path('.') + File::SEPARATOR
files.reject do |f|
File.expand_path(f) !~ %r{^#{cur_dir}}
end
6 lazy_dir_test.rb
View
@@ -51,12 +51,12 @@ def test_lazy_glob_secure
assert LazyDir['../../*'].to_a.empty?
puts "\nbig glob test... this may take a while"
- orig = OrigDir['*.rb'].map {|f| File.expand_path(f) }
- lazy = LazyDir['../**/*.rb'].to_a.map {|f| File.expand_path(f) }
+ orig = OrigDir['./**/*'].map {|f| File.expand_path(f) }
+ lazy = LazyDir['../**/*'].to_a.map {|f| File.expand_path(f) }
assert_equal orig, lazy
end
- def test_call_original_dir_methods
+ def test_lazy_dir_delegates_original_dir_methods
assert Dir.pwd
dir = 'asfasdfsaf'
assert Dir.mkdir(dir)
Please sign in to comment.
Something went wrong with that request. Please try again.