From 19614ba2477f3d12468f5ec251ce1cc5f8c6210c Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Thu, 23 Feb 2023 17:17:48 -0500 Subject: Rename ActivityPub Serializer Specs (#23844) --- .../activitypub/update_poll_serializer_spec.rb | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 spec/serializers/activitypub/update_poll_serializer_spec.rb (limited to 'spec/serializers/activitypub/update_poll_serializer_spec.rb') diff --git a/spec/serializers/activitypub/update_poll_serializer_spec.rb b/spec/serializers/activitypub/update_poll_serializer_spec.rb new file mode 100644 index 000000000..4360808b5 --- /dev/null +++ b/spec/serializers/activitypub/update_poll_serializer_spec.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe ActivityPub::UpdatePollSerializer do + subject { JSON.parse(@serialization.to_json) } + + let(:account) { Fabricate(:account) } + let(:poll) { Fabricate(:poll, account: account) } + let!(:status) { Fabricate(:status, account: account, poll: poll) } + + before(:each) do + @serialization = ActiveModelSerializers::SerializableResource.new(status, serializer: ActivityPub::UpdatePollSerializer, adapter: ActivityPub::Adapter) + end + + it 'has a Update type' do + expect(subject['type']).to eql('Update') + end + + it 'has an object with Question type' do + expect(subject['object']['type']).to eql('Question') + end + + it 'has the correct actor URI set' do + expect(subject['actor']).to eql(ActivityPub::TagManager.instance.uri_for(account)) + end +end -- cgit