2016-02-25 01:17:01 +02:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe ReblogService do
|
2016-02-28 22:22:56 +02:00
|
|
|
let(:alice) { Fabricate(:account, username: 'alice') }
|
|
|
|
let(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com', salmon_url: 'http://salmon.example.com') }
|
|
|
|
let(:status) { Fabricate(:status, account: bob, uri: 'tag:example.com;something:something') }
|
|
|
|
|
|
|
|
subject { ReblogService.new }
|
|
|
|
|
|
|
|
before do
|
2016-11-12 00:37:39 +02:00
|
|
|
stub_request(:post, Rails.configuration.x.hub_url)
|
2016-02-28 22:22:56 +02:00
|
|
|
stub_request(:post, 'http://salmon.example.com')
|
|
|
|
|
|
|
|
subject.(alice, status)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'creates a reblog' do
|
|
|
|
expect(status.reblogs.count).to eq 1
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'pings PubSubHubbub hubs' do
|
2016-11-12 00:37:39 +02:00
|
|
|
expect(a_request(:post, Rails.configuration.x.hub_url)).to have_been_made
|
2016-02-28 22:22:56 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'sends a Salmon slap for a remote reblog' do
|
|
|
|
expect(a_request(:post, 'http://salmon.example.com')).to have_been_made
|
|
|
|
end
|
2016-02-25 01:17:01 +02:00
|
|
|
end
|