Class: ModelContextProtocol::RSpec::Matchers::BeValidMcpPromptResponse
- Inherits:
-
Object
- Object
- ModelContextProtocol::RSpec::Matchers::BeValidMcpPromptResponse
- Defined in:
- lib/model_context_protocol/rspec/matchers/be_valid_mcp_prompt_response.rb
Constant Summary collapse
- VALID_ROLES =
%w[user assistant].freeze
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize ⇒ BeValidMcpPromptResponse
constructor
A new instance of BeValidMcpPromptResponse.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize ⇒ BeValidMcpPromptResponse
Returns a new instance of BeValidMcpPromptResponse.
18 19 20 |
# File 'lib/model_context_protocol/rspec/matchers/be_valid_mcp_prompt_response.rb', line 18 def initialize @failure_reasons = [] end |
Instance Method Details
#description ⇒ Object
42 43 44 |
# File 'lib/model_context_protocol/rspec/matchers/be_valid_mcp_prompt_response.rb', line 42 def description "be a valid MCP prompt response" end |
#failure_message ⇒ Object
33 34 35 36 |
# File 'lib/model_context_protocol/rspec/matchers/be_valid_mcp_prompt_response.rb', line 33 def "expected #{@actual.class} to be a valid MCP prompt response, but:\n" + @failure_reasons.map { |reason| " - #{reason}" }.join("\n") end |
#failure_message_when_negated ⇒ Object
38 39 40 |
# File 'lib/model_context_protocol/rspec/matchers/be_valid_mcp_prompt_response.rb', line 38 def "expected #{@actual.class} not to be a valid MCP prompt response, but it was" end |
#matches?(actual) ⇒ Boolean
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/model_context_protocol/rspec/matchers/be_valid_mcp_prompt_response.rb', line 22 def matches?(actual) @actual = actual @failure_reasons = [] @serialized = serialize_response(actual) return false if @serialized.nil? validate_structure && end |