logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

process_account_service_spec.rb (1018B)


  1. require 'rails_helper'
  2. RSpec.describe ActivityPub::ProcessAccountService do
  3. subject { described_class.new }
  4. context 'property values' do
  5. let(:payload) do
  6. {
  7. id: 'https://foo',
  8. type: 'Actor',
  9. inbox: 'https://foo/inbox',
  10. attachment: [
  11. { type: 'PropertyValue', name: 'Pronouns', value: 'They/them' },
  12. { type: 'PropertyValue', name: 'Occupation', value: 'Unit test' },
  13. ],
  14. }.with_indifferent_access
  15. end
  16. it 'parses out of attachment' do
  17. account = subject.call('alice', 'example.com', payload)
  18. expect(account.fields).to be_a Array
  19. expect(account.fields.size).to eq 2
  20. expect(account.fields[0]).to be_a Account::Field
  21. expect(account.fields[0].name).to eq 'Pronouns'
  22. expect(account.fields[0].value).to eq 'They/them'
  23. expect(account.fields[1]).to be_a Account::Field
  24. expect(account.fields[1].name).to eq 'Occupation'
  25. expect(account.fields[1].value).to eq 'Unit test'
  26. end
  27. end
  28. end