Class: SunspotMatchers::BeASearchForSession
- Inherits:
-
Object
- Object
- SunspotMatchers::BeASearchForSession
- Defined in:
- lib/sunspot_matchers/test_helper.rb
Instance Method Summary collapse
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(session, expected_class) ⇒ BeASearchForSession
constructor
A new instance of BeASearchForSession.
- #match? ⇒ Boolean
- #search_tuple ⇒ Object
- #search_types ⇒ Object
Constructor Details
#initialize(session, expected_class) ⇒ BeASearchForSession
Returns a new instance of BeASearchForSession.
41 42 43 44 |
# File 'lib/sunspot_matchers/test_helper.rb', line 41 def initialize(session, expected_class) @session = session @expected_class = expected_class end |
Instance Method Details
#failure_message_for_should ⇒ Object
60 61 62 |
# File 'lib/sunspot_matchers/test_helper.rb', line 60 def "expected search class: #{search_types.join(' and ')} to match expected class: #{@expected_class}" end |
#failure_message_for_should_not ⇒ Object
64 65 66 |
# File 'lib/sunspot_matchers/test_helper.rb', line 64 def "expected search class: #{search_types.join(' and ')} NOT to match expected class: #{@expected_class}" end |
#match? ⇒ Boolean
46 47 48 |
# File 'lib/sunspot_matchers/test_helper.rb', line 46 def match? search_types.include?(@expected_class) end |
#search_tuple ⇒ Object
50 51 52 53 54 |
# File 'lib/sunspot_matchers/test_helper.rb', line 50 def search_tuple search_tuple = @session.is_a?(Array) ? @session : @session.searches.last raise 'no search found' unless search_tuple search_tuple end |
#search_types ⇒ Object
56 57 58 |
# File 'lib/sunspot_matchers/test_helper.rb', line 56 def search_types search_tuple.first end |