mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 17:35:40 +01:00
Reduce factory generation in AccountStatusesFilter
spec (#32727)
This commit is contained in:
parent
2271b39a5c
commit
ff490daa58
1 changed files with 15 additions and 27 deletions
|
@ -52,36 +52,24 @@ RSpec.describe AccountStatusesFilter do
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples 'filter params' do
|
shared_examples 'filter params' do
|
||||||
context 'with only_media param' do
|
it 'respects param options in results' do
|
||||||
let(:params) { { only_media: true } }
|
expect(results_for(only_media: true))
|
||||||
|
.to all(satisfy(&:with_media?))
|
||||||
|
|
||||||
it 'returns only statuses with media' do
|
expect(results_for(tagged: tag.name))
|
||||||
expect(subject.all?(&:with_media?)).to be true
|
.to all(satisfy { |status| status.tags.include?(tag) })
|
||||||
end
|
|
||||||
|
expect(results_for(exclude_replies: true))
|
||||||
|
.to all(satisfy { |status| !status.reply? })
|
||||||
|
|
||||||
|
expect(results_for(exclude_reblogs: true))
|
||||||
|
.to all(satisfy { |status| !status.reblog? })
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with tagged param' do
|
def results_for(params)
|
||||||
let(:params) { { tagged: tag.name } }
|
described_class
|
||||||
|
.new(account, current_account, params)
|
||||||
it 'returns only statuses with tag' do
|
.results
|
||||||
expect(subject.all? { |s| s.tags.include?(tag) }).to be true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with exclude_replies param' do
|
|
||||||
let(:params) { { exclude_replies: true } }
|
|
||||||
|
|
||||||
it 'returns only statuses that are not replies' do
|
|
||||||
expect(subject.none?(&:reply?)).to be true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with exclude_reblogs param' do
|
|
||||||
let(:params) { { exclude_reblogs: true } }
|
|
||||||
|
|
||||||
it 'returns only statuses that are not reblogs' do
|
|
||||||
expect(subject.none?(&:reblog?)).to be true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue