-
-
Save aCandidMind/8772d1278620f5a88f34158dfdfea7a4 to your computer and use it in GitHub Desktop.
Coupling - mock,stub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Below is a StackOverflow comment where this gist was linked from.