Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add rspec coverage.

  • Loading branch information...
commit 64803ff8052f89b101dae84d16ebbef648ae962d 1 parent e28684a
@halogenandtoast halogenandtoast authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 spec/copycopter_client/sync_spec.rb
View
21 spec/copycopter_client/sync_spec.rb
@@ -19,6 +19,27 @@ def build_sync(config = {})
after { @syncs.each { |sync| sync.stop } }
+ it "syncs when the process terminates" do
+ api_key = "12345"
+ FakeCopycopterApp.add_project api_key
+ pid = fork do
+ config = { :logger => FakeLogger.new, :polling_delay => 86400, :api_key => api_key }
+ default_config = CopycopterClient::Configuration.new.to_hash.update(config)
+ real_client = CopycopterClient::Client.new(default_config)
+ sync = CopycopterClient::Sync.new(real_client, default_config)
+ sync.start
+ sleep 2
+ sync['test.key'] = 'value'
+ Signal.trap("INT") { exit }
+ sleep
+ end
+ sleep 3
+ Process.kill("INT", pid)
+ Process.wait
+ project = FakeCopycopterApp.project(api_key)
+ project.draft['test.key'].should == 'value'
+ end
+
it "provides access to downloaded data" do
client['en.test.key'] = 'expected'
client['en.test.other_key'] = 'expected'
Please sign in to comment.
Something went wrong with that request. Please try again.