This repository has been archived on 2019-05-14. You can view files and clone it, but cannot push or open issues or pull requests.
mastodon/spec/services/reblog_service_spec.rb

31 lines
902 B
Ruby
Raw Normal View History

2016-02-24 23:17:01 +00:00
require 'rails_helper'
RSpec.describe ReblogService do
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
Rails.configuration.x.hub_url = 'http://hub.example.com'
stub_request(:post, 'http://hub.example.com')
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
expect(a_request(:post, 'http://hub.example.com')).to have_been_made
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-24 23:17:01 +00:00
end