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.
38 39 40 41 |
# File 'lib/sunspot_matchers/test_helper.rb', line 38 def initialize(session, expected_class) @session = session @expected_class = expected_class end |
Instance Method Details
#failure_message_for_should ⇒ Object
57 58 59 |
# File 'lib/sunspot_matchers/test_helper.rb', line 57 def "expected search class: #{search_types.join(' and ')} to match expected class: #{@expected_class}" end |
#failure_message_for_should_not ⇒ Object
61 62 63 |
# File 'lib/sunspot_matchers/test_helper.rb', line 61 def "expected search class: #{search_types.join(' and ')} NOT to match expected class: #{@expected_class}" end |
#match? ⇒ Boolean
43 44 45 |
# File 'lib/sunspot_matchers/test_helper.rb', line 43 def match? search_types.include?(@expected_class) end |
#search_tuple ⇒ Object
47 48 49 50 51 |
# File 'lib/sunspot_matchers/test_helper.rb', line 47 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
53 54 55 |
# File 'lib/sunspot_matchers/test_helper.rb', line 53 def search_types search_tuple.first end |