Skip to content
Browse files

write tests, fix redis require statement, and rename param for <<

  • Loading branch information...
1 parent 6ea7c3b commit a904e44aec3b021991004f572ecdcc41cf127f9b Scott Reis committed Oct 21, 2011
Showing with 65 additions and 3 deletions.
  1. +2 −2 lib/anemone/queue/base.rb
  2. +1 −1 lib/anemone/queue/redis.rb
  3. +62 −0 spec/queue_spec.rb
View
4 lib/anemone/queue/base.rb
@@ -15,8 +15,8 @@ def initialize(adapter)
end
end
- def <<(val)
- @adap << val rescue raise InsertionError, $!
+ def <<(job)
+ @adap << job rescue raise InsertionError, $!
end
def deq
View
2 lib/anemone/queue/redis.rb
@@ -1,5 +1,5 @@
begin
- require 'redis-client'
+ require 'redis'
rescue LoadError
puts "You need the redis-client gem to use Anemone::Queue::Redis"
exit
View
62 spec/queue_spec.rb
@@ -0,0 +1,62 @@
+require 'spec_helper'
+
+module Anemone
+ module Queue
+
+ describe Redis do
+
+ describe '#initialize' do
+ it 'creates a new Redis queue' do
+ pending
+ end
+ end
+
+ describe '<<' do
+ context 'given a job' do
+ it 'pushes it onto the back' do
+ pending
+ end
+ end
+ end
+
+ describe 'deq' do
+ it 'pops a job off the front and returns it' do
+ pending
+ end
+ end
+
+ describe 'empty?' do
+ context 'when the queue is empty' do
+ it 'returns true' do
+ pendign
+ end
+ end
+ context 'when the queue is not empty' do
+ it 'returns false' do
+ pending
+ end
+ end
+ end
+
+ describe 'size' do
+ it 'returns how many jobs exist' do
+ pending
+ end
+ end
+
+ describe 'num_waiting' do
+ it 'returns how many jobs are in waiting state' do
+ pending
+ end
+ end
+
+ describe 'clear' do
+ it 'clears all the jobs' do
+ pending
+ end
+ end
+
+ end
+
+ end
+end

0 comments on commit a904e44

Please sign in to comment.
Something went wrong with that request. Please try again.