63
edits
Changes
→Solr Testing Is Easy with Rspec-Solr Gem
Avoid the whole app stack when writing Solr acceptance/relevancy/regression tests! Forget cucumber and capybara. This gem lets you easily (only 4 short files needed!) write tests like this, passing arbitrary parameters to Solr:
it "unstemmed author name Zare should precede stemmed variants" do resp = solr_response(author_search_args('Zare').merge({'fl'=>'id,author_person_display', 'facet'=>false})) resp.should include("author_person_display" => /\bZare\W/).in_each_of_first(3).documents resp.should_not include("author_person_display" => /Zaring/).in_each_of_first(20).documents end it "Cyrillic searching should work: Восемьсoт семьдесят один день" do resp = solr_resp_doc_ids_only({'q'=>'Восемьсoт семьдесят один день'}) resp.should include("9091779") end it "q of 'String quartets Parts' and variants should be plausible " do resp = solr_resp_doc_ids_only({'q'=>'String quartets Parts'}) resp.should have_at_least(2000).documents resp.should have_the_same_number_of_results_as(solr_resp_doc_ids_only({'q'=>'(String quartets Parts)'})) resp.should have_more_results_than(solr_resp_doc_ids_only({'q'=>'"String quartets Parts"'})) end
it "Traditional Chinese chars 三國誌 should get the same results as simplified chars 三国志" do
resp = solr_response({'q'=>'三國誌', 'fl'=>'id', 'facet'=>false})