diff options
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/fetch_webfinger_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/workers/fetch_webfinger_spec.rb b/spec/workers/fetch_webfinger_spec.rb new file mode 100644 index 000000000..cfa83b24a --- /dev/null +++ b/spec/workers/fetch_webfinger_spec.rb @@ -0,0 +1,20 @@ +require "spec_helper" + +describe Workers::FetchWebfinger do + it "should webfinger and queue a job to fetch public posts" do + @person = FactoryGirl.create(:person) + allow(Webfinger).to receive(:new).and_return(double(fetch: @person)) + + expect(Diaspora::Fetcher::Public).to receive(:queue_for).exactly(1).times + + Workers::FetchWebfinger.new.perform(@person.diaspora_handle) + end + + it "should webfinger and queue no job to fetch public posts if the person is not found" do + allow(Webfinger).to receive(:new).and_return(double(fetch: nil)) + + expect(Diaspora::Fetcher::Public).not_to receive(:queue_for) + + Workers::FetchWebfinger.new.perform("unknown-person@example.net") + end +end |