闭社主体 forked from https://github.com/tootsuite/mastodon
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.

30 lines
902 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. Rails.configuration.x.hub_url = 'http://hub.example.com'
  9. stub_request(:post, 'http://hub.example.com')
  10. stub_request(:post, 'http://salmon.example.com')
  11. subject.(alice, status)
  12. end
  13. it 'creates a reblog' do
  14. expect(status.reblogs.count).to eq 1
  15. end
  16. it 'pings PubSubHubbub hubs' do
  17. expect(a_request(:post, 'http://hub.example.com')).to have_been_made
  18. end
  19. it 'sends a Salmon slap for a remote reblog' do
  20. expect(a_request(:post, 'http://salmon.example.com')).to have_been_made
  21. end
  22. end