Add: _misskey_license
の送受信 (#968)
This commit is contained in:
parent
9c14810881
commit
c139f8947e
8 changed files with 110 additions and 3 deletions
53
spec/lib/activitypub/parser/custom_emoji_parser_spec.rb
Normal file
53
spec/lib/activitypub/parser/custom_emoji_parser_spec.rb
Normal file
|
@ -0,0 +1,53 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::Parser::CustomEmojiParser do
|
||||
subject { described_class.new(json) }
|
||||
|
||||
context 'with fedibird license' do
|
||||
let(:json) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: ['https://example.com/#foo'].join,
|
||||
name: 'ohagi',
|
||||
license: 'Ohagi is ohagi',
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
it 'load license' do
|
||||
expect(subject.license).to eq 'Ohagi is ohagi'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with misskey license' do
|
||||
let(:json) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: ['https://example.com/#foo'].join,
|
||||
name: 'ohagi',
|
||||
_misskey_license: {
|
||||
freeText: 'Ohagi is ohagi',
|
||||
},
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
it 'load license' do
|
||||
expect(subject.license).to eq 'Ohagi is ohagi'
|
||||
end
|
||||
end
|
||||
|
||||
context 'without license' do
|
||||
let(:json) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: ['https://example.com/#foo'].join,
|
||||
name: 'ohagi',
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
it 'do not load license' do
|
||||
expect(subject.license).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
33
spec/serializers/activitypub/emoji_serializer_spec.rb
Normal file
33
spec/serializers/activitypub/emoji_serializer_spec.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ActivityPub::EmojiSerializer do
|
||||
describe '.serializer_for' do
|
||||
subject { serialized_record_json(model, described_class, adapter: ActivityPub::Adapter) }
|
||||
|
||||
let(:model) { Fabricate(:custom_emoji) }
|
||||
|
||||
context 'without license' do
|
||||
it 'does not have information' do
|
||||
expect(subject).to_not include({
|
||||
'_misskey_license' => { 'freeText' => 'Ohagi' },
|
||||
})
|
||||
expect(subject).to_not include({
|
||||
'license' => 'Ohagi',
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
context 'with license' do
|
||||
let(:model) { Fabricate(:custom_emoji, license: 'Ohagi') }
|
||||
|
||||
it 'has information' do
|
||||
expect(subject).to include({
|
||||
'license' => 'Ohagi',
|
||||
'_misskey_license' => { 'freeText' => 'Ohagi' },
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue