Class: SunspotMatchers::HaveSearchParamsForSession

Inherits:
Object
  • Object
show all
Includes:
MiniTest::Assertions
Defined in:
lib/sunspot_matchers/test_helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(session, method, *args, &block) ⇒ HaveSearchParamsForSession

Returns a new instance of HaveSearchParamsForSession.



9
10
11
12
13
# File 'lib/sunspot_matchers/test_helper.rb', line 9

def initialize(session, method, *args, &block)
  @session = session
  @method = method
  @args = (block.nil? ? args : [*args, block])
end

Instance Method Details

#get_matcherObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/sunspot_matchers/test_helper.rb', line 15

def get_matcher
  matcher_class = case @method
    when :with
      WithMatcher
    when :without
      WithoutMatcher
    when :keywords, :fulltext
      KeywordsMatcher
    when :boost
      BoostMatcher
    when :facet
      FacetMatcher
    when :order_by
      OrderByMatcher
    when :paginate
      PaginationMatcher
  end
  matcher_class.new(@session, @args)
end