Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Delegate flush

  • Loading branch information...
commit dd02da830a553a0568d64673af6898815904fd9f 1 parent 7c597cd
@halogenandtoast halogenandtoast authored
View
6 lib/copycopter_client.rb
@@ -34,6 +34,12 @@ def self.start_sync
sync.start
end
+ # Flush queued changed synchronously
+ # This is called from the Resque after perform "hook"
+ def self.flush
+ sync.flush
+ end
+
# Call this method to modify defaults in your initializers.
#
# @example
View
2  lib/copycopter_client/sync.rb
@@ -136,7 +136,7 @@ def register_job_hooks
alias_method :perform_without_copycopter, :perform
def perform
job_was_performed = perform_without_copycopter
- CopycopterClient.sync.flush
+ CopycopterClient.flush
job_was_performed
end
end
View
10 spec/copycopter_client/sync_spec.rb
@@ -335,5 +335,15 @@ def violated(failure)
sync.should have_received(:start)
end
+
+ it "flushes from the top level" do
+ sync = build_sync
+ CopycopterClient.sync = sync
+ sync.stubs(:flush)
+
+ CopycopterClient.flush
+
+ sync.should have_received(:flush)
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.