Sha256: 85ab12f8736aac60eb3feff0020e405f053a39cc3681ac7f4772643ac74354c0
Contents?: true
Size: 1.07 KB
Versions: 4
Compression:
Stored size: 1.07 KB
Contents
require 'acceptance/spec_helper' describe 'Searching across models', :live => true do it "returns results" do article = Article.create! :title => 'Pancakes' index expect(ThinkingSphinx.search.first).to eq(article) end it "returns results matching the given query" do pancakes = Article.create! :title => 'Pancakes' waffles = Article.create! :title => 'Waffles' index articles = ThinkingSphinx.search 'pancakes' expect(articles).to include(pancakes) expect(articles).not_to include(waffles) end it "handles results from different models" do article = Article.create! :title => 'Pancakes' book = Book.create! :title => 'American Gods' index expect(ThinkingSphinx.search.to_a).to match_array([article, book]) end it "filters by multiple classes" do article = Article.create! :title => 'Pancakes' book = Book.create! :title => 'American Gods' user = User.create! :name => 'Pat' index expect(ThinkingSphinx.search(:classes => [User, Article]).to_a). to match_array([article, user]) end end
Version data entries
4 entries across 4 versions & 1 rubygems