let!(:relay_account) { Fabricate(:account, inbox_url: 'https://relay.example.com/inbox') }
let!(:relay) { Fabricate(:relay, inbox_url: 'https://relay.example.com/inbox') }
+ let(:object_json) { 'https://example.com/actor/hello-world' }
+
subject { described_class.new(json, sender, relayed_through_account: relay_account) }
+ before do
+ stub_request(:get, 'https://example.com/actor/hello-world').to_return(body: Oj.dump(unknown_object_json))
+ end
+
context 'and the relay is enabled' do
before do
relay.update(state: :accepted)
subject.perform
end
- let(:object_json) do
- {
- id: 'https://example.com/actor#bar',
- type: 'Note',
- content: 'Lorem ipsum',
- to: 'http://example.com/followers',
- attributedTo: 'https://example.com/actor',
- }
- end
-
- it 'creates a reblog by sender of status' do
- expect(sender.statuses.count).to eq 2
+ it 'fetches the remote status' do
+ expect(a_request(:get, 'https://example.com/actor/hello-world')).to have_been_made
+ expect(Status.find_by(uri: 'https://example.com/actor/hello-world').text).to eq 'Hello world'
end
end
subject.perform
end
- let(:object_json) do
- {
- id: 'https://example.com/actor#bar',
- type: 'Note',
- content: 'Lorem ipsum',
- to: 'http://example.com/followers',
- attributedTo: 'https://example.com/actor',
- }
+ it 'does not fetch the remote status' do
+ expect(a_request(:get, 'https://example.com/actor/hello-world')).not_to have_been_made
+ expect(Status.find_by(uri: 'https://example.com/actor/hello-world')).to be_nil
end
it 'does not create anything' do