update_poll_spec.rb 822 B

123456789101112131415161718192021222324252627
  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