Sha256: 67eadd98f307194ebb751cb97af11a53b4392be0c24798eb137c4fa4365f1701
Contents?: true
Size: 1.11 KB
Versions: 42
Compression:
Stored size: 1.11 KB
Contents
require File.expand_path('spec_helper', File.dirname(__FILE__)) describe 'search with dynamic fields' do it 'returns dynamic string facet' do stub_facet(:"custom_string:test_ss", 'two' => 2, 'one' => 1) result = session.search(Post) { dynamic(:custom_string) { facet(:test) }} result.facet(:custom_string, :test).rows.map { |row| row.value }.should == ['two', 'one'] end it 'returns dynamic field facet with custom label' do stub_facet(:"bogus", 'two' => 2, 'one' => 1) result = session.search(Post) { dynamic(:custom_string) { facet(:test, :name => :bogus) }} result.facet(:bogus).rows.map { |row| row.value }.should == ['two', 'one'] end it 'returns query facet specified in dynamic call' do stub_query_facet( 'custom_string\:test_ss:(foo OR bar)' => 3 ) search = session.search(Post) do dynamic :custom_string do facet :test do row :foo_bar do with :test, %w(foo bar) end end end end facet = search.facet(:test) facet.rows.first.value.should == :foo_bar facet.rows.first.count.should == 3 end end
Version data entries
42 entries across 42 versions & 10 rubygems