add spec to test searching for INNER search term
This commit is contained in:
@@ -158,6 +158,19 @@ describe PgSearchable do
|
||||
expect(DynamicModelWithTagValues.scope_search('tag:green or value:"not"')).to contain_exactly(record1, record2)
|
||||
end
|
||||
|
||||
it 'can search for search term containing INNER word' do
|
||||
records = DynamicModelWithTagValues.create [{ name: 'inner', value: 'amazing' },
|
||||
{ name: 'new record', value: 'INNER' }]
|
||||
|
||||
Tag.create [{ taggable: records[0], value: 'red', custom_attribute: 'rose' },
|
||||
{ taggable: records[1], value: 'INNER', custom_attribute: 'garden' }]
|
||||
|
||||
expect(DynamicModelWithTagValues.scope_search('name:inner')).to contain_exactly(records[0])
|
||||
expect(DynamicModelWithTagValues.scope_search('value:INNER')).to contain_exactly(records[1])
|
||||
expect(DynamicModelWithTagValues.scope_search('tag:inner')).to contain_exactly(records[1])
|
||||
expect(DynamicModelWithTagValues.scope_search('tag:INNER')).to contain_exactly(records[1])
|
||||
end
|
||||
|
||||
describe 'searching in model with has_many association' do
|
||||
before do
|
||||
records = DynamicModelWithTagValues.create [{ name: 'something', value: 'amazing' },
|
||||
@@ -325,9 +338,6 @@ describe PgSearchable do
|
||||
end
|
||||
|
||||
it 'can search in referenced column associated with through relaction - simple search with NOT operator' do
|
||||
puts "==========="
|
||||
puts Player.scope_search('NOT tag:e-ink').inspect
|
||||
puts "==============="
|
||||
expect(Player.scope_search('NOT tag:e-ink')).to contain_exactly(players[2], players[3])
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user