Class: SunspotMatchersTestunit::BeASearchFor
- Inherits:
-
Object
- Object
- SunspotMatchersTestunit::BeASearchFor
- Defined in:
- lib/sunspot_matchers_testunit/matchers.rb
Instance Method Summary collapse
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(session, expected_class) ⇒ BeASearchFor
constructor
A new instance of BeASearchFor.
- #match? ⇒ Boolean
- #search_tuple ⇒ Object
- #search_types ⇒ Object
Constructor Details
#initialize(session, expected_class) ⇒ BeASearchFor
Returns a new instance of BeASearchFor.
276 277 278 279 |
# File 'lib/sunspot_matchers_testunit/matchers.rb', line 276 def initialize(session, expected_class) @session = session @expected_class = expected_class end |
Instance Method Details
#failure_message_for_should ⇒ Object
295 296 297 |
# File 'lib/sunspot_matchers_testunit/matchers.rb', line 295 def "expected search class: #{search_types.join(' and ')} to match expected class: #{@expected_class}" end |
#failure_message_for_should_not ⇒ Object
299 300 301 |
# File 'lib/sunspot_matchers_testunit/matchers.rb', line 299 def "expected search class: #{search_types.join(' and ')} NOT to match expected class: #{@expected_class}" end |
#match? ⇒ Boolean
281 282 283 |
# File 'lib/sunspot_matchers_testunit/matchers.rb', line 281 def match? search_types.include?(@expected_class) end |
#search_tuple ⇒ Object
285 286 287 288 289 |
# File 'lib/sunspot_matchers_testunit/matchers.rb', line 285 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
291 292 293 |
# File 'lib/sunspot_matchers_testunit/matchers.rb', line 291 def search_types search_tuple.first end |