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.

22 lines
725 B

  1. require 'rails_helper'
  2. RSpec.describe ProcessMentionsService do
  3. let(:account) { Fabricate(:account, username: 'alice') }
  4. let(:remote_user) { Fabricate(:account, username: 'remote_user', domain: 'example.com', salmon_url: 'http://salmon.example.com') }
  5. let(:status) { Fabricate(:status, account: account, text: "Hello @#{remote_user.acct}") }
  6. subject { ProcessMentionsService.new }
  7. before do
  8. stub_request(:post, remote_user.salmon_url)
  9. subject.(status)
  10. end
  11. it 'creates a mention' do
  12. expect(remote_user.mentions.where(status: status).count).to eq 1
  13. end
  14. it 'posts to remote user\'s Salmon end point' do
  15. expect(a_request(:post, remote_user.salmon_url)).to have_been_made
  16. end
  17. end