Class: ModelContextProtocol::RSpec::Matchers::HaveResourceLinkContent
- Inherits:
-
Object
- Object
- ModelContextProtocol::RSpec::Matchers::HaveResourceLinkContent
- Defined in:
- lib/model_context_protocol/rspec/matchers/have_resource_link_content.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(uri: nil, name: nil) ⇒ HaveResourceLinkContent
constructor
A new instance of HaveResourceLinkContent.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(uri: nil, name: nil) ⇒ HaveResourceLinkContent
25 26 27 28 29 |
# File 'lib/model_context_protocol/rspec/matchers/have_resource_link_content.rb', line 25 def initialize(uri: nil, name: nil) @expected_uri = uri @expected_name = name @failure_reasons = [] end |
Instance Method Details
#description ⇒ Object
53 54 55 56 |
# File 'lib/model_context_protocol/rspec/matchers/have_resource_link_content.rb', line 53 def description constraints = "have resource link content#{constraints}" end |
#failure_message ⇒ Object
42 43 44 45 46 |
# File 'lib/model_context_protocol/rspec/matchers/have_resource_link_content.rb', line 42 def constraints = "expected response to have resource link content#{constraints}, but:\n" + @failure_reasons.map { |reason| " - #{reason}" }.join("\n") end |
#failure_message_when_negated ⇒ Object
48 49 50 51 |
# File 'lib/model_context_protocol/rspec/matchers/have_resource_link_content.rb', line 48 def constraints = "expected response not to have resource link content#{constraints}, but it did" end |
#matches?(actual) ⇒ Boolean
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/model_context_protocol/rspec/matchers/have_resource_link_content.rb', line 31 def matches?(actual) @actual = actual @failure_reasons = [] @serialized = serialize_response(actual) return false if @serialized.nil? validate_has_content && validate_has_resource_link_content end |