about summary refs log tree commit diff
path: root/spec/services
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2018-02-19 15:17:14 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2018-02-19 15:17:14 +0000
commit1445ba17033cdfdd21d0999f65267754af6344af (patch)
tree4919ecd746c8dec4be33af47d83f11cec098cf69 /spec/services
parent3d033a468748338b6036cb24bb00ea4e88656ae6 (diff)
parent66105929e07fc7ddbdb8b66696b9ce1ed5d25957 (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/fetch_remote_status_service_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/services/fetch_remote_status_service_spec.rb b/spec/services/fetch_remote_status_service_spec.rb
index cbdecbf25..fa5782b94 100644
--- a/spec/services/fetch_remote_status_service_spec.rb
+++ b/spec/services/fetch_remote_status_service_spec.rb
@@ -1,4 +1,35 @@
 require 'rails_helper'
 
 RSpec.describe FetchRemoteStatusService do
+  let(:account) { Fabricate(:account) }
+  let(:prefetched_body) { nil }
+  let(:valid_domain) { Rails.configuration.x.local_domain }
+
+  let(:note) do
+    {
+      '@context': 'https://www.w3.org/ns/activitystreams',
+      id: "https://#{valid_domain}/@foo/1234",
+      type: 'Note',
+      content: 'Lorem ipsum',
+      attributedTo: ActivityPub::TagManager.instance.uri_for(account),
+    }
+  end
+
+  context 'protocol is :activitypub' do
+    subject { described_class.new.call(note[:id], prefetched_body, protocol) }
+    let(:prefetched_body) { Oj.dump(note) }
+    let(:protocol) { :activitypub }
+
+    before do
+      account.update(uri: ActivityPub::TagManager.instance.uri_for(account))
+      subject
+    end
+
+    it 'creates status' do
+      status = account.statuses.first
+
+      expect(status).to_not be_nil
+      expect(status.text).to eq 'Lorem ipsum'
+    end
+  end
 end