summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/ripper/test_files.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/ripper/test_files.rb b/test/ripper/test_files.rb
index 447519d5b40..ac24727e9b6 100644
--- a/test/ripper/test_files.rb
+++ b/test/ripper/test_files.rb
@@ -35,7 +35,9 @@ class TestRipper::Generic < Test::Unit::TestCase
end
dir = ARGV.shift
scripts = Dir.chdir(dir) {Dir[pattern]}
- scripts = scripts.sample(scripts.size * TEST_RATIO) if TEST_RATIO < 1.0
+ if (1...scripts.size).include?(num = scripts.size * TEST_RATIO)
+ scripts = scripts.sample(num)
+ end
scripts.sort!
for script in scripts
assert_nothing_raised {