|
30 | 30 | expect(subject.call(url)).to eq known_account |
31 | 31 | end |
32 | 32 |
|
| 33 | + context 'when searching for a remote collection', feature: :collections do |
| 34 | + let(:account) { Fabricate(:account) } |
| 35 | + let(:collection_account) { Fabricate(:account, domain: 'example.com', protocol: :activitypub) } |
| 36 | + |
| 37 | + let(:uri) { 'https://example.com/featured_collections/1' } |
| 38 | + |
| 39 | + let(:payload) do |
| 40 | + { |
| 41 | + '@context' => 'https://www.w3.org/ns/activitystreams', |
| 42 | + 'id' => uri, |
| 43 | + 'type' => 'FeaturedCollection', |
| 44 | + 'name' => 'Incredible people', |
| 45 | + 'summary' => 'These are really amazing', |
| 46 | + 'attributedTo' => collection_account.uri, |
| 47 | + 'sensitive' => false, |
| 48 | + 'discoverable' => true, |
| 49 | + 'totalItems' => 0, |
| 50 | + } |
| 51 | + end |
| 52 | + |
| 53 | + before do |
| 54 | + stub_request(:get, uri).to_return(status: 200, body: payload.to_json, headers: { 'Content-Type': 'application/activity+json' }) |
| 55 | + end |
| 56 | + |
| 57 | + it 'returns the collection' do |
| 58 | + expect(subject.call(uri, on_behalf_of: account)) |
| 59 | + .to be_a(Collection) |
| 60 | + .and have_attributes( |
| 61 | + uri: uri |
| 62 | + ) |
| 63 | + end |
| 64 | + end |
| 65 | + |
| 66 | + context 'when searching for a local collection', feature: :collections do |
| 67 | + let(:account) { Fabricate(:account) } |
| 68 | + let(:collection) { Fabricate(:collection) } |
| 69 | + |
| 70 | + it 'returns the collection' do |
| 71 | + expect(subject.call(ActivityPub::TagManager.instance.uri_for(collection), on_behalf_of: account)) |
| 72 | + .to eq(collection) |
| 73 | + end |
| 74 | + end |
| 75 | + |
33 | 76 | context 'when searching for a remote private status' do |
34 | 77 | let(:account) { Fabricate(:account) } |
35 | 78 | let(:poster) { Fabricate(:account, domain: 'example.com') } |
|
0 commit comments