You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
850 B

  1. require 'rails_helper'
  2. RSpec.describe ReblogService do
  3. let(:alice) { Fabricate(:account, username: 'alice') }
  4. let(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com', salmon_url: 'http://salmon.example.com') }
  5. let(:status) { Fabricate(:status, account: bob, uri: 'tag:example.com;something:something') }
  6. subject { ReblogService.new }
  7. before do
  8. stub_request(:post, Rails.configuration.x.hub_url)
  9. stub_request(:post, 'http://salmon.example.com')
  10. subject.(alice, status)
  11. end
  12. it 'creates a reblog' do
  13. expect(status.reblogs.count).to eq 1
  14. end
  15. it 'pings PubSubHubbub hubs' do
  16. expect(a_request(:post, Rails.configuration.x.hub_url)).to have_been_made
  17. end
  18. it 'sends a Salmon slap for a remote reblog' do
  19. expect(a_request(:post, 'http://salmon.example.com')).to have_been_made
  20. end
  21. end