public_statuses_index_spec.rb 554 B

12345678910111213141516171819202122232425262728293031
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe PublicStatusesIndex do
  4. describe 'Searching the index' do
  5. before do
  6. mock_elasticsearch_response(described_class, raw_response)
  7. end
  8. it 'returns results from a query' do
  9. results = described_class.query(match: { name: 'status' })
  10. expect(results).to eq []
  11. end
  12. end
  13. def raw_response
  14. {
  15. took: 3,
  16. hits: {
  17. hits: [
  18. {
  19. _id: '0',
  20. _score: 1.6375021,
  21. },
  22. ],
  23. },
  24. }
  25. end
  26. end