Permalink
Browse files

- Make `mintiest` only supported unit test framework for tests.

- Remove `turn` gem.
  • Loading branch information...
lantins committed Mar 9, 2012
1 parent cf7963b commit 649282425873be39008012f2e3189ce043e83c69
Showing with 33 additions and 29 deletions.
  1. +2 −1 .gitignore
  2. +4 −0 HISTORY.md
  3. +1 −1 README.md
  4. +2 −2 Rakefile
  5. +1 −0 lib/resque-lock-timeout.rb
  6. +1 −1 lib/resque/plugins/lock_timeout.rb
  7. +2 −2 resque-lock-timeout.gemspec
  8. +5 −6 test/lock_test.rb
  9. +15 −16 test/test_helper.rb
View
@@ -1,4 +1,5 @@
.gem
.yardoc
doc/
-Gemfile.lock
+Gemfile.lock
+coverage/
View
@@ -1,3 +1,7 @@
+## 0.3.2 (2012-03-09)
+
+* Release changes nothing of importance, tested against v1.20.0 of resque.
+
## 0.3.1 (2011-07-16)
* Pass job arguments to `lock_timeout`. (Bob Potter)
View
@@ -1,7 +1,7 @@
Resque Lock Timeout
===================
-A [Resque][rq] plugin. Requires Resque >= 01.8.0.
+A [Resque][rq] plugin. Requires Resque >= v1.8.0.
resque-lock-timeout adds locking, with optional timeout/deadlock handling to
resque jobs.
View
@@ -4,7 +4,7 @@ require 'yard/rake/yardoc_task'
task :default => :test
-desc 'Run tests.'
+desc 'Run unit tests.'
Rake::TestTask.new(:test) do |task|
task.test_files = FileList['test/*_test.rb']
task.verbose = true
@@ -13,7 +13,7 @@ end
desc 'Build Yardoc documentation.'
YARD::Rake::YardocTask.new :yardoc do |t|
t.files = ['lib/**/*.rb']
- t.options = ['--output-dir', "doc/",
+ t.options = ['--output-dir', 'doc/',
'--files', 'LICENSE,HISTORY.md',
'--readme', 'README.md',
'--title', 'resque-lock-timeout documentation']
@@ -1 +1,2 @@
+require 'resque'
require 'resque/plugins/lock_timeout'
@@ -62,7 +62,7 @@ def lock_redis
# @param [Array] args job arguments
# @return [String] redis key
def redis_lock_key(*args)
- ['lock', name, identifier(*args)].compact.join(":")
+ ['lock', name, identifier(*args)].compact.join(':')
end
# Number of seconds the lock may be held for.
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'resque-lock-timeout'
- s.version = '0.3.1'
+ s.version = '0.3.2'
s.date = Time.now.strftime('%Y-%m-%d')
s.summary = 'A Resque plugin adding locking, with optional timeout/deadlock handling to resque jobs.'
s.homepage = 'http://github.com/lantins/resque-lock-timeout'
@@ -16,9 +16,9 @@ Gem::Specification.new do |s|
s.add_development_dependency('rake')
s.add_development_dependency('minitest')
s.add_development_dependency('json')
- s.add_development_dependency('turn')
s.add_development_dependency('yard')
s.add_development_dependency('rdiscount')
+ s.add_development_dependency('simplecov', '>= 0.3.0')
s.description = <<desc
A Resque plugin. Adds locking, with optional timeout/deadlock handling to
View
@@ -1,16 +1,15 @@
require File.dirname(__FILE__) + '/test_helper'
-class LockTest < Test::Unit::TestCase
+class LockTest < MiniTest::Unit::TestCase
def setup
$success = $lock_failed = $lock_expired = 0
Resque.redis.flushall
@worker = Resque::Worker.new(:test)
end
- def test_lint
- assert_nothing_raised do
- Resque::Plugin.lint(Resque::Plugins::LockTimeout)
- end
+ def test_resque_plugin_lint
+ # will raise exception if were not a good plugin.
+ assert Resque::Plugin.lint(Resque::Plugins::LockTimeout)
end
def test_version
@@ -120,7 +119,7 @@ def test_lock_with_specific_redis
# this is nil in Resque.redis since we make no attempt to add a resque:
# prefix to the key
assert_nil Resque.redis.get('specific_redis')
- assert_not_nil lock_redis.get('specific_redis')
+ assert lock_redis.get('specific_redis')
thread.join
assert_nil lock_redis.get('specific_redis')
View
@@ -2,40 +2,39 @@
$LOAD_PATH.unshift dir + '/../lib'
$TESTING = true
-require 'test/unit'
-require 'resque'
-require 'turn'
+gem 'minitest'
+require 'minitest/unit'
+require 'minitest/pride'
+require 'simplecov'
+
+SimpleCov.start do
+ add_filter '/test/'
+end
require 'resque-lock-timeout'
require dir + '/test_jobs'
-##
# make sure we can run redis
-if !system("which redis-server")
+if !system('which redis-server')
puts '', "** can't find `redis-server` in your path"
- puts "** try running `sudo rake install`"
+ puts '** try running `sudo rake install`'
abort ''
end
-##
# start our own redis when the tests start,
# kill it when they end
at_exit do
next if $!
- if defined?(MiniTest)
- exit_code = MiniTest::Unit.new.run(ARGV)
- else
- exit_code = Test::Unit::AutoRunner.run
- end
+ exit_code = MiniTest::Unit.new.run(ARGV)
- pid = `ps -e -o pid,command | grep [r]edis-test`.split(" ")[0]
- puts "Killing test redis server..."
+ pid = `ps -e -o pid,command | grep [r]edis-test`.split(' ')[0]
+ puts 'Killing test redis server...'
`rm -f #{dir}/dump.rdb`
- Process.kill("KILL", pid.to_i)
+ Process.kill('KILL', pid.to_i)
exit exit_code
end
-puts "Starting redis for testing at localhost:9736..."
+puts 'Starting redis for testing at localhost:9736...'
`redis-server #{dir}/redis-test.conf`
Resque.redis = '127.0.0.1:9736'

0 comments on commit 6492824

Please sign in to comment.