about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-09-01 22:06:40 +0200
committerGitHub <noreply@github.com>2021-09-01 22:06:40 +0200
commit2b18f7a9436c29ff948b1c1fe9b777435d1b03c1 (patch)
treef3dec6cc6f253e6e70dccb989360624ceeb72a83 /spec
parentf81ff4e5ed68c1e5fb5a4bf9374cd86acc1a94c0 (diff)
Fix processing mentions to domains with non-ascii TLDs (#16689)
Fixes #16602
Diffstat (limited to 'spec')
-rw-r--r--spec/services/process_mentions_service_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/services/process_mentions_service_spec.rb b/spec/services/process_mentions_service_spec.rb
index 3b2f9d698..d74e8dc62 100644
--- a/spec/services/process_mentions_service_spec.rb
+++ b/spec/services/process_mentions_service_spec.rb
@@ -42,6 +42,24 @@ RSpec.describe ProcessMentionsService, type: :service do
         expect(a_request(:post, remote_user.inbox_url)).to have_been_made.once
       end
     end
+
+    context 'with an IDN TLD' do
+      let(:remote_user) { Fabricate(:account, username: 'foo', protocol: :activitypub, domain: 'xn--y9a3aq.xn--y9a3aq', inbox_url: 'http://example.com/inbox') }
+      let(:status) { Fabricate(:status, account: account, text: "Hello @foo@հայ.հայ") }
+
+      before do
+        stub_request(:post, remote_user.inbox_url)
+        subject.call(status)
+      end
+
+      it 'creates a mention' do
+        expect(remote_user.mentions.where(status: status).count).to eq 1
+      end
+
+      it 'sends activity to the inbox' do
+        expect(a_request(:post, remote_user.inbox_url)).to have_been_made.once
+      end
+    end
   end
 
   context 'Temporarily-unreachable ActivityPub user' do