diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-05-10 17:09:12 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-05-10 17:09:12 +0200 |
commit | 68629f2773a056b0120b956e0cb425e73fe57cab (patch) | |
tree | 94f79c3baeec31b58d36e37515b753b9d2a02ab6 /spec/services | |
parent | 3191c3b349f67442f3ae42be6e1b141e2392a293 (diff) | |
parent | 780d99c204df824fe959a3db00999f973a29c351 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - app/controllers/statuses_controller.rb minor conflict because of glitch-soc's theming system - app/controllers/stream_entries_controller.rb minor conflict because of glitch-soc's theming system
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/process_mentions_service_spec.rb | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/spec/services/process_mentions_service_spec.rb b/spec/services/process_mentions_service_spec.rb index 963924fa9..8a6bb44ac 100644 --- a/spec/services/process_mentions_service_spec.rb +++ b/spec/services/process_mentions_service_spec.rb @@ -1,10 +1,11 @@ require 'rails_helper' RSpec.describe ProcessMentionsService, type: :service do - let(:account) { Fabricate(:account, username: 'alice') } - let(:status) { Fabricate(:status, account: account, text: "Hello @#{remote_user.acct}") } + let(:account) { Fabricate(:account, username: 'alice') } + let(:visibility) { :public } + let(:status) { Fabricate(:status, account: account, text: "Hello @#{remote_user.acct}", visibility: visibility) } - context 'OStatus' do + context 'OStatus with public toot' do let(:remote_user) { Fabricate(:account, username: 'remote_user', protocol: :ostatus, domain: 'example.com', salmon_url: 'http://salmon.example.com') } subject { ProcessMentionsService.new } @@ -23,6 +24,26 @@ RSpec.describe ProcessMentionsService, type: :service do end end + context 'OStatus with private toot' do + let(:visibility) { :private } + let(:remote_user) { Fabricate(:account, username: 'remote_user', protocol: :ostatus, domain: 'example.com', salmon_url: 'http://salmon.example.com') } + + subject { ProcessMentionsService.new } + + before do + stub_request(:post, remote_user.salmon_url) + subject.call(status) + end + + it 'does not create a mention' do + expect(remote_user.mentions.where(status: status).count).to eq 0 + end + + it 'does not post to remote user\'s Salmon end point' do + expect(a_request(:post, remote_user.salmon_url)).to_not have_been_made + end + end + context 'ActivityPub' do let(:remote_user) { Fabricate(:account, username: 'remote_user', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') } |