Class: ModelContextProtocol::RSpec::Matchers::HaveResourceAnnotations
- Inherits:
-
Object
- Object
- ModelContextProtocol::RSpec::Matchers::HaveResourceAnnotations
- Defined in:
- lib/model_context_protocol/rspec/matchers/have_resource_annotations.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(expected_annotations) ⇒ HaveResourceAnnotations
constructor
A new instance of HaveResourceAnnotations.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(expected_annotations) ⇒ HaveResourceAnnotations
Returns a new instance of HaveResourceAnnotations.
22 23 24 25 |
# File 'lib/model_context_protocol/rspec/matchers/have_resource_annotations.rb', line 22 def initialize(expected_annotations) @expected_annotations = expected_annotations @failure_reasons = [] end |
Instance Method Details
#description ⇒ Object
47 48 49 |
# File 'lib/model_context_protocol/rspec/matchers/have_resource_annotations.rb', line 47 def description "have resource annotations matching #{@expected_annotations.inspect}" end |
#failure_message ⇒ Object
38 39 40 41 |
# File 'lib/model_context_protocol/rspec/matchers/have_resource_annotations.rb', line 38 def "expected resource response to have annotations matching #{@expected_annotations.inspect}, but:\n" + @failure_reasons.map { |reason| " - #{reason}" }.join("\n") end |
#failure_message_when_negated ⇒ Object
43 44 45 |
# File 'lib/model_context_protocol/rspec/matchers/have_resource_annotations.rb', line 43 def "expected resource response not to have annotations matching #{@expected_annotations.inspect}, but it did" end |
#matches?(actual) ⇒ Boolean
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/model_context_protocol/rspec/matchers/have_resource_annotations.rb', line 27 def matches?(actual) @actual = actual @failure_reasons = [] @serialized = serialize_response(actual) return false if @serialized.nil? validate_has_contents && validate_has_annotations end |