diff options
author | Kazushige Tominaga <kazu9su@gmail.com> | 2018-02-19 00:34:03 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2018-02-18 16:34:03 +0100 |
commit | 78936461d77e3c5c60dc2430c309c8caf670ac2e (patch) | |
tree | 5a0962b075c452fb5aa32131e2f0a8ad663878d0 /spec/services | |
parent | bc6751ecce2ba81e074fa3b672a3fe5ee6004302 (diff) |
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
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/fetch_remote_status_service_spec.rb | 31 |
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 |