Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Kiesel <james.kiesel@gmail.com>2014-12-27 15:44:53 +0300
committerJames Kiesel <james.kiesel@gmail.com>2015-01-14 14:20:19 +0300
commit1c69dd77529903713bf16f2ad0a41b386aa172da (patch)
treeb0999e6b1cf64af23d911c32ce4642066b732147 /spec/workers
parente5d725a6041b2b6503f44a8f15940913a732d9ad (diff)
Add contacts/posts, and GZipping JSON exporter output
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/export_user_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/workers/export_user_spec.rb b/spec/workers/export_user_spec.rb
new file mode 100644
index 000000000..f6ecfba55
--- /dev/null
+++ b/spec/workers/export_user_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper'
+
+describe Workers::ExportUser do
+
+ before do
+ allow(User).to receive(:find).with(alice.id).and_return(alice)
+ end
+
+ it 'calls export! on user with given id' do
+ expect(alice).to receive(:perform_export!)
+ Workers::ExportUser.new.perform(alice.id)
+ end
+
+ it 'sends a success message when the export is successful' do
+ alice.stub(:export).and_return(OpenStruct.new)
+ expect(ExportMailer).to receive(:export_complete_for).with(alice)
+ Workers::ExportUser.new.perform(alice.id)
+ end
+
+ it 'sends a failure message when the export fails' do
+ alice.stub(:export).and_return(nil)
+ expect(alice).to receive(:perform_export!).and_return(false)
+ expect(ExportMailer).to receive(:export_failure_for).with(alice)
+ Workers::ExportUser.new.perform(alice.id)
+ end
+end