From 77f0e250a4205de2af64a75fa132ffaae7e5cef9 Mon Sep 17 00:00:00 2001 From: Kazushige Tominaga Date: Mon, 19 Feb 2018 00:34:03 +0900 Subject: [PATCH] Added fetch_remote_status_service call spec case actibitypub (#6500) * Added #link_header spec * Added #call spec * Delete spec of private methods * Added call test case activitypub --- .../fetch_remote_status_service_spec.rb | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/spec/services/fetch_remote_status_service_spec.rb b/spec/services/fetch_remote_status_service_spec.rb index cbdecbf25f..fa5782b94a 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