|
1 | 1 | require 'rails_helper' |
2 | 2 |
|
3 | 3 | RSpec.describe ProcessMentionsService, type: :service do |
4 | | - let(:account) { Fabricate(:account, username: 'alice') } |
5 | | - let(:status) { Fabricate(:status, account: account, text: "Hello @#{remote_user.acct}") } |
| 4 | + let(:account) { Fabricate(:account, username: 'alice') } |
| 5 | + let(:visibility) { :public } |
| 6 | + let(:status) { Fabricate(:status, account: account, text: "Hello @#{remote_user.acct}", visibility: visibility) } |
6 | 7 |
|
7 | | - context 'OStatus' do |
| 8 | + context 'OStatus with public toot' do |
8 | 9 | let(:remote_user) { Fabricate(:account, username: 'remote_user', protocol: :ostatus, domain: 'example.com', salmon_url: 'http://salmon.example.com') } |
9 | 10 |
|
10 | 11 | subject { ProcessMentionsService.new } |
|
23 | 24 | end |
24 | 25 | end |
25 | 26 |
|
| 27 | + context 'OStatus with private toot' do |
| 28 | + let(:visibility) { :private } |
| 29 | + let(:remote_user) { Fabricate(:account, username: 'remote_user', protocol: :ostatus, domain: 'example.com', salmon_url: 'http://salmon.example.com') } |
| 30 | + |
| 31 | + subject { ProcessMentionsService.new } |
| 32 | + |
| 33 | + before do |
| 34 | + stub_request(:post, remote_user.salmon_url) |
| 35 | + subject.call(status) |
| 36 | + end |
| 37 | + |
| 38 | + it 'does not create a mention' do |
| 39 | + expect(remote_user.mentions.where(status: status).count).to eq 0 |
| 40 | + end |
| 41 | + |
| 42 | + it 'does not post to remote user\'s Salmon end point' do |
| 43 | + expect(a_request(:post, remote_user.salmon_url)).to_not have_been_made |
| 44 | + end |
| 45 | + end |
| 46 | + |
26 | 47 | context 'ActivityPub' do |
27 | 48 | let(:remote_user) { Fabricate(:account, username: 'remote_user', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') } |
28 | 49 |
|
|
0 commit comments