public
anonymous / gist:5101448
Created

Coupling - mock,stub

  • Download Gist
gistfile1.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
class RequestsSchedule
 
def fetch_all_expired
# fetch and return all expired definitions from MongoDB
# e.g. use MongoClient somehow
end
end
 
class RequestToQueuePusher
 
QUEUE_NAME = 'requests'
 
def enqueue(requests)
each.requests { |r| enqueue_single(r) }
end
 
private
 
def enqueue_singe(request)
#locate messages queue
# push request to queue
end
 
end
 
class SchedulerJob
 
def run
expired_requests = RequestSchedule.new.fetch_all_expired
RequestToQueuePusher.new.enqueue(expired_requests)
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.