Class: Sunspot::Rails::StubSessionProxy
- Inherits:
-
Object
- Object
- Sunspot::Rails::StubSessionProxy
- Defined in:
- lib/stub_solr/sunspot_rails_stub_session_proxy.rb
Overview
stub solr with “dara” array for testing. if there is no data then it will behave like default blank search this stub uses Kaminari for pagination once the data is given, solr search block will call search and that will create a new Search with arguments. With the search, it passes the given data as @operation_context. And “run_proc_block” method will go through each search conditions in the block. while going through the block, it will change @operation_context
Defined Under Namespace
Classes: Search
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#range_fields ⇒ Object
readonly
Returns the value of attribute range_fields.
Instance Method Summary collapse
-
#initialize(original_session, data = []) ⇒ StubSessionProxy
constructor
A new instance of StubSessionProxy.
- #search(*types, &block) ⇒ Object
- #set_range_fields(arr) ⇒ Object
Constructor Details
#initialize(original_session, data = []) ⇒ StubSessionProxy
Returns a new instance of StubSessionProxy.
14 15 16 17 18 |
# File 'lib/stub_solr/sunspot_rails_stub_session_proxy.rb', line 14 def initialize(original_session, data = []) @original_session = original_session @data = data @range_fields = %w[time month created_at start end] end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
12 13 14 |
# File 'lib/stub_solr/sunspot_rails_stub_session_proxy.rb', line 12 def block @block end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
12 13 14 |
# File 'lib/stub_solr/sunspot_rails_stub_session_proxy.rb', line 12 def data @data end |
#range_fields ⇒ Object (readonly)
Returns the value of attribute range_fields.
12 13 14 |
# File 'lib/stub_solr/sunspot_rails_stub_session_proxy.rb', line 12 def range_fields @range_fields end |
Instance Method Details
#search(*types, &block) ⇒ Object
24 25 26 |
# File 'lib/stub_solr/sunspot_rails_stub_session_proxy.rb', line 24 def search(*types, &block) Search.new(@data, types, &block) end |
#set_range_fields(arr) ⇒ Object
20 21 22 |
# File 'lib/stub_solr/sunspot_rails_stub_session_proxy.rb', line 20 def set_range_fields(arr) @range_fields = arr end |