Class: AgnosticBackend::RSpec::Matchers::DefineIndexField
- Inherits:
-
Object
- Object
- AgnosticBackend::RSpec::Matchers::DefineIndexField
- Defined in:
- lib/agnostic_backend/rspec/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(name, for_index: nil, type: nil, **expected_custom_attributes) ⇒ DefineIndexField
constructor
A new instance of DefineIndexField.
- #matches?(klass) ⇒ Boolean
Constructor Details
#initialize(name, for_index: nil, type: nil, **expected_custom_attributes) ⇒ DefineIndexField
Returns a new instance of DefineIndexField.
19 20 21 22 23 24 |
# File 'lib/agnostic_backend/rspec/matchers.rb', line 19 def initialize(name, for_index: nil, type: nil, **expected_custom_attributes) @name = name @for_index = for_index @type = type @expected_custom_attributes = expected_custom_attributes end |
Instance Method Details
#description ⇒ Object
36 37 38 |
# File 'lib/agnostic_backend/rspec/matchers.rb', line 36 def description end |
#failure_message ⇒ Object
40 41 42 |
# File 'lib/agnostic_backend/rspec/matchers.rb', line 40 def "expected to #{}" end |
#matches?(klass) ⇒ Boolean
26 27 28 29 30 31 32 33 34 |
# File 'lib/agnostic_backend/rspec/matchers.rb', line 26 def matches?(klass) @for_index ||= klass.index_name manager = klass.index_content_manager(@for_index) manager.nil? and return false field = manager.contents[@name.to_s] field.nil? and return false type_matches?(field, @type) && custom_attributes_match?(field, @expected_custom_attributes) rescue false end |