class SunspotMatchers::HaveSearchParams

Public Class Methods

new(method, *args, &block) click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 128
def initialize(method, *args, &block)
  @method = method
  @args = (block.nil? ? args : [*args, block])
end

Public Instance Methods

failure_message() click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 139
def failure_message
  @matcher.missing_param_error_message
end
failure_message_when_negated() click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 143
def failure_message_when_negated
  @matcher.unexpected_match_error_message
end
get_matcher() click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 147
def get_matcher
  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
    when :group
      GroupMatcher
  end
end
matches?(actual) click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 133
def matches?(actual)
  @actual = actual
  @matcher = get_matcher.new(@actual, @args)
  @matcher.match?
end