diff --git a/Rakefile b/Rakefile index 43022f7..661094e 100644 --- a/Rakefile +++ b/Rakefile @@ -1,2 +1,9 @@ require "bundler/gem_tasks" task :default => :spec + +require 'rake/testtask' +Rake::TestTask.new :test do |test| + test.libs << 'lib' << 'test' + test.pattern = 'test/**/test_*.rb' + test.verbose = true +end diff --git a/test/helper.rb b/test/helper.rb index ae51d27..ae0af92 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -1,5 +1,6 @@ require 'rubygems' require 'bundler' + begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e @@ -7,6 +8,7 @@ rescue Bundler::BundlerError => e $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end + require 'test/unit' require 'shoulda' @@ -14,9 +16,6 @@ require 'timeout' require 'benchmark' require 'ffi/libc' -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) -$LOAD_PATH.unshift(File.dirname(__FILE__)) - require 'timeout_interrupt' class Test::Unit::TestCase diff --git a/test/test_ruby-timeout-interrupt.rb b/test/test_ruby-timeout-interrupt.rb index 7e87cfe..3567eae 100644 --- a/test/test_ruby-timeout-interrupt.rb +++ b/test/test_ruby-timeout-interrupt.rb @@ -4,7 +4,7 @@ class TestRubyTimeoutInterrupt < Test::Unit::TestCase def blocking t = FFI::LibC.fopen '/dev/ptmx', 'r' b = FFI::LibC.malloc 1025 - s = FFI::LibC.fread b, 1, 1024, t + FFI::LibC.fread b, 1, 1024, t ensure FFI::LibC.fclose t if t FFI::LibC.free b if b @@ -114,7 +114,7 @@ class TestRubyTimeoutInterrupt < Test::Unit::TestCase called = false prepared.call do assert_raise TimeoutInterrupt::Error, 'It should time out after one second, but it did not.' do - prepared.call { 2; sleep 2 } + prepared.call { _ = 2; sleep 2 } end called = true end