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

fetch_webfinger_spec.rb « workers « spec - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3ed3e4ffa585b19fa63ca936ed73c4f3fe684ebb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

describe Workers::FetchWebfinger do
  it "should webfinger and queue a job to fetch public posts" do
    @person = FactoryGirl.create(:person)
    allow(Person).to receive(:find_or_fetch_by_identifier).and_return(@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(Person).to receive(:find_or_fetch_by_identifier).and_raise DiasporaFederation::Discovery::DiscoveryError

    expect(Diaspora::Fetcher::Public).not_to receive(:queue_for)

    Workers::FetchWebfinger.new.perform("unknown-person@example.net")
  end
end