闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
822 B

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe ActivityPub::UpdatePollSerializer do
  4. let(:account) { Fabricate(:account) }
  5. let(:poll) { Fabricate(:poll, account: account) }
  6. let!(:status) { Fabricate(:status, account: account, poll: poll) }
  7. before(:each) do
  8. @serialization = ActiveModelSerializers::SerializableResource.new(status, serializer: ActivityPub::UpdatePollSerializer, adapter: ActivityPub::Adapter)
  9. end
  10. subject { JSON.parse(@serialization.to_json) }
  11. it 'has a Update type' do
  12. expect(subject['type']).to eql('Update')
  13. end
  14. it 'has an object with Question type' do
  15. expect(subject['object']['type']).to eql('Question')
  16. end
  17. it 'has the correct actor URI set' do
  18. expect(subject['actor']).to eql(ActivityPub::TagManager.instance.uri_for(account))
  19. end
  20. end