|
75 | 75 |
|
76 | 76 | shared_examples 'sets pinned posts' do |
77 | 77 | before do |
78 | | - stub_request(:get, 'https://example.com/account/pinned/known').to_return(status: 200, body: JSON.generate(status_json_pinned_known), headers: { 'Content-Type': 'application/activity+json' }) |
79 | | - stub_request(:get, 'https://example.com/account/pinned/unknown-inlined').to_return(status: 200, body: JSON.generate(status_json_pinned_unknown_inlined), headers: { 'Content-Type': 'application/activity+json' }) |
| 78 | + stub_request(:get, 'https://example.com/account/pinned/known').to_return(status: 200, body: status_json_pinned_known.to_json, headers: { 'Content-Type': 'application/activity+json' }) |
| 79 | + stub_request(:get, 'https://example.com/account/pinned/unknown-inlined').to_return(status: 200, body: status_json_pinned_unknown_inlined.to_json, headers: { 'Content-Type': 'application/activity+json' }) |
80 | 80 | stub_request(:get, 'https://example.com/account/pinned/unknown-unreachable').to_return(status: 404) |
81 | | - stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: JSON.generate(status_json_pinned_unknown_reachable), headers: { 'Content-Type': 'application/activity+json' }) |
82 | | - stub_request(:get, 'https://example.com/account/collections/featured').to_return(status: 200, body: JSON.generate(featured_with_null), headers: { 'Content-Type': 'application/activity+json' }) |
| 81 | + stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: status_json_pinned_unknown_reachable.to_json, headers: { 'Content-Type': 'application/activity+json' }) |
| 82 | + stub_request(:get, 'https://example.com/account/collections/featured').to_return(status: 200, body: featured_with_null.to_json, headers: { 'Content-Type': 'application/activity+json' }) |
83 | 83 |
|
84 | 84 | subject |
85 | 85 | end |
|
101 | 101 | let(:collection_or_uri) { actor.featured_collection_url } |
102 | 102 |
|
103 | 103 | before do |
104 | | - stub_request(:get, actor.featured_collection_url).to_return(status: 200, body: JSON.generate(payload), headers: { 'Content-Type': 'application/activity+json' }) |
| 104 | + stub_request(:get, actor.featured_collection_url).to_return(status: 200, body: payload.to_json, headers: { 'Content-Type': 'application/activity+json' }) |
105 | 105 | end |
106 | 106 |
|
107 | 107 | it_behaves_like 'sets pinned posts' |
|
122 | 122 |
|
123 | 123 | context 'when the endpoint is a Collection' do |
124 | 124 | before do |
125 | | - stub_request(:get, actor.featured_collection_url).to_return(status: 200, body: JSON.generate(payload), headers: { 'Content-Type': 'application/activity+json' }) |
| 125 | + stub_request(:get, actor.featured_collection_url).to_return(status: 200, body: payload.to_json, headers: { 'Content-Type': 'application/activity+json' }) |
126 | 126 | end |
127 | 127 |
|
128 | 128 | it_behaves_like 'sets pinned posts' |
|
139 | 139 | end |
140 | 140 |
|
141 | 141 | before do |
142 | | - stub_request(:get, actor.featured_collection_url).to_return(status: 200, body: JSON.generate(payload), headers: { 'Content-Type': 'application/activity+json' }) |
| 142 | + stub_request(:get, actor.featured_collection_url).to_return(status: 200, body: payload.to_json, headers: { 'Content-Type': 'application/activity+json' }) |
143 | 143 | end |
144 | 144 |
|
145 | 145 | it_behaves_like 'sets pinned posts' |
|
148 | 148 | let(:items) { 'https://example.com/account/pinned/unknown-reachable' } |
149 | 149 |
|
150 | 150 | before do |
151 | | - stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: JSON.generate(status_json_pinned_unknown_reachable), headers: { 'Content-Type': 'application/activity+json' }) |
152 | | - subject |
| 151 | + stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: status_json_pinned_unknown_reachable.to_json, headers: { 'Content-Type': 'application/activity+json' }) |
153 | 152 | end |
154 | 153 |
|
155 | 154 | it 'sets expected posts as pinned posts' do |
| 155 | + subject |
| 156 | + |
156 | 157 | expect(actor.pinned_statuses.pluck(:uri)).to contain_exactly( |
157 | 158 | 'https://example.com/account/pinned/unknown-reachable' |
158 | 159 | ) |
|
175 | 176 | end |
176 | 177 |
|
177 | 178 | before do |
178 | | - stub_request(:get, actor.featured_collection_url).to_return(status: 200, body: JSON.generate(payload), headers: { 'Content-Type': 'application/activity+json' }) |
| 179 | + stub_request(:get, actor.featured_collection_url).to_return(status: 200, body: payload.to_json, headers: { 'Content-Type': 'application/activity+json' }) |
179 | 180 | end |
180 | 181 |
|
181 | 182 | it_behaves_like 'sets pinned posts' |
|
184 | 185 | let(:items) { 'https://example.com/account/pinned/unknown-reachable' } |
185 | 186 |
|
186 | 187 | before do |
187 | | - stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: JSON.generate(status_json_pinned_unknown_reachable), headers: { 'Content-Type': 'application/activity+json' }) |
188 | | - subject |
| 188 | + stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: status_json_pinned_unknown_reachable.to_json, headers: { 'Content-Type': 'application/activity+json' }) |
189 | 189 | end |
190 | 190 |
|
191 | 191 | it 'sets expected posts as pinned posts' do |
| 192 | + subject |
| 193 | + |
192 | 194 | expect(actor.pinned_statuses.pluck(:uri)).to contain_exactly( |
193 | 195 | 'https://example.com/account/pinned/unknown-reachable' |
194 | 196 | ) |
|
0 commit comments