Sha256: 6b0d4a4e168196f2f07317c103a0fb260fdf62a67dca48ee33e6d2a049ed4560

Contents?: true

Size: 1.26 KB

Versions: 28

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

describe MultiSolr::SearchRequest do

  context "define_filter" do

    TEST_FILTER = {
        :simple_sample => {},
        :collection_sample => {:type => :collection},
        :date_sample => {:type => :date},
        :date_range_sample => {:type => :date_range},
        :free_sample => {:type => :free_query},
    }

    subject do
      sr_class = Class.new(MultiSolr::SearchRequest)
      # die Test-Filter definieren
      TEST_FILTER.each do |filtername, options|
        sr_class.define_filter filtername, options.clone
      end
      sr_class
    end

    context "class behaviour" do

      TEST_FILTER.each do |filtername, options|
        type = (options && options[:type]) || :simple
        it "should have '#{filtername}' as filter from type #{type}" do
          filter_class = MultiSolr::SearchRequest::BASE_FILTER_MAP[type]
          filter = subject.possible_filters[filtername]
          filter.should be_a(filter_class)
        end

        it "should have define filter getter/setter-methods" do
          r = subject.new
          r.should be_respond_to("filter_#{filtername}")
          r.should be_respond_to("filter_#{filtername}=")
        end
      end
    end # of context "class behaviour"


  end # of context "define_filter"

end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
multi-solr-01.06.00 spec/multi_solr/search_request_spec.rb
multi-solr-01.05.00 spec/multi_solr/search_request_spec.rb
multi-solr-01.04.00 spec/multi_solr/search_request_spec.rb
multi-solr-01.03.00 spec/multi_solr/search_request_spec.rb
multi-solr-01.02.01 spec/multi_solr/search_request_spec.rb
multi-solr-01.02.00 spec/multi_solr/search_request_spec.rb
multi-solr-01.01.06 spec/multi_solr/search_request_spec.rb
multi-solr-01.01.05 spec/multi_solr/search_request_spec.rb