mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Merge commit '9d5e10a70e006c1c0bc61e7f591b1078c7be6ab4' into glitch-soc/merge-upstream
This commit is contained in:
@@ -338,6 +338,23 @@ RSpec.describe Tag do
|
||||
expect(results).to eq [tag]
|
||||
end
|
||||
|
||||
it 'finds tag records from padded term queries' do
|
||||
tag = Fabricate(:tag, name: 'MATCH')
|
||||
_miss_tag = Fabricate(:tag, name: 'miss')
|
||||
|
||||
results = described_class.search_for(' match ')
|
||||
|
||||
expect(results)
|
||||
.to contain_exactly(tag)
|
||||
end
|
||||
|
||||
it 'handles nil query' do
|
||||
results = described_class.search_for(nil)
|
||||
|
||||
expect(results)
|
||||
.to be_empty
|
||||
end
|
||||
|
||||
it 'finds the exact matching tag as the first item' do
|
||||
similar_tag = Fabricate(:tag, name: 'matchlater', reviewed_at: Time.now.utc)
|
||||
tag = Fabricate(:tag, name: 'match', reviewed_at: Time.now.utc)
|
||||
@@ -364,5 +381,16 @@ RSpec.describe Tag do
|
||||
|
||||
expect(results).to eq [tag, unlisted_tag]
|
||||
end
|
||||
|
||||
it 'excludes non reviewed tags via option' do
|
||||
tag = Fabricate(:tag, name: 'match', reviewed_at: 5.days.ago)
|
||||
unreviewed_tag = Fabricate(:tag, name: 'matchreviewed', reviewed_at: nil)
|
||||
|
||||
results = described_class.search_for('match', 5, 0, exclude_unreviewed: true)
|
||||
|
||||
expect(results)
|
||||
.to include(tag)
|
||||
.and not_include(unreviewed_tag)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user