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.

31 lines
1.0 KiB

  1. require 'rails_helper'
  2. RSpec.describe ActivityPub::ProcessAccountService, type: :service do
  3. subject { described_class.new }
  4. context 'property values' do
  5. let(:payload) do
  6. {
  7. id: 'https://foo.test',
  8. type: 'Actor',
  9. inbox: 'https://foo.test/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