can_lookup_search_index_attributes_examples.rb 876 B

12345678910111213141516171819202122232425
  1. RSpec.shared_examples 'CanLookupSearchIndexAttributes' do
  2. describe '.search_index_value_by_attribute' do
  3. it 'returns search index value for attribute' do
  4. organization = create(:organization, name: 'Tomato42', note: 'special recipe')
  5. user = create(:agent, organization: organization)
  6. value = user.search_index_value_by_attribute('organization_id')
  7. expect(value['name']).to eq('Tomato42')
  8. end
  9. end
  10. describe '.search_index_attribute_ref_name' do
  11. it 'returns correct value' do
  12. attribute_ref_name = User.search_index_attribute_ref_name('organization_id')
  13. expect(attribute_ref_name).to eq('organization')
  14. end
  15. end
  16. describe '.search_index_attribute_ignored?' do
  17. it 'returns correct value' do
  18. ignored = User.search_index_attribute_ignored?('password')
  19. expect(ignored).to be true
  20. end
  21. end
  22. end