class SunspotMatchers::SunspotSessionSpy

Attributes

current_search_class[R]
original_session[R]
searches[RW]

Public Class Methods

new(original_session) click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 23
def initialize(original_session)
  # Support Sunspot random field in test -- Sunspot originally generate a random number for the field
  # Only patch method if SunspotSessionSpy is initialized to prevent poisoning class simply by being included in Gemfile.
  Sunspot::Query::Sort::RandomSort.class_eval do
    remove_method :to_param
    define_method :to_param do
      "random #{direction_for_solr}"
    end
  end

  @searches = []
  @original_session = original_session
  @config = Sunspot::Configuration.build
end

Public Instance Methods

commit(soft_delete = false) click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 80
def commit(soft_delete = false)
end
commit_if_delete_dirty(soft_delete = false) click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 77
def commit_if_delete_dirty(soft_delete = false)
end
commit_if_dirty(soft_delete = false) click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 74
def commit_if_dirty(soft_delete = false)
end
delete_dirty?() click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 70
def delete_dirty?
  false
end
dirty?() click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 66
def dirty?
  false
end
index(*objects) click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 42
def index(*objects)
end
index!(*objects) click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 45
def index!(*objects)
end
inspect() click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 38
def inspect
  'Solr Search'
end
more_like_this(object, *types, &block) click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 117
def more_like_this(object, *types, &block)
  new_more_like_this(object, *types, &block)
end
remove(*objects) click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 48
def remove(*objects)
end
remove!(*objects) click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 51
def remove!(*objects)
end
remove_all(clazz = nil) click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 60
def remove_all(clazz = nil)
end
remove_all!(clazz = nil) click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 63
def remove_all!(clazz = nil)
end
remove_by_id(clazz, id) click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 54
def remove_by_id(clazz, id)
end
remove_by_id!(clazz, id) click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 57
def remove_by_id!(clazz, id)
end
setup_for_types(types) click to toggle source
# File lib/sunspot_matchers/sunspot_session_spy.rb, line 106
def setup_for_types(types)
  if types.empty?
    raise(ArgumentError, "You must specify at least one type to search")
  end
  if types.length == 1
    Sunspot::Setup.for(types.first)
  else
    Sunspot::CompositeSetup.for(types)
  end
end