Class: ModelContextProtocol::RSpec::Matchers::BeValidMcpClass
- Inherits:
-
Object
- Object
- ModelContextProtocol::RSpec::Matchers::BeValidMcpClass
- Defined in:
- lib/model_context_protocol/rspec/matchers/be_valid_mcp_class.rb
Constant Summary collapse
- BASE_CLASSES =
{ tool: ModelContextProtocol::Server::Tool, prompt: ModelContextProtocol::Server::Prompt, resource: ModelContextProtocol::Server::Resource, resource_template: ModelContextProtocol::Server::ResourceTemplate }.freeze
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(expected_type) ⇒ BeValidMcpClass
constructor
A new instance of BeValidMcpClass.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(expected_type) ⇒ BeValidMcpClass
Returns a new instance of BeValidMcpClass.
29 30 31 32 |
# File 'lib/model_context_protocol/rspec/matchers/be_valid_mcp_class.rb', line 29 def initialize(expected_type) @expected_type = expected_type @failure_reasons = [] end |
Instance Method Details
#description ⇒ Object
52 53 54 |
# File 'lib/model_context_protocol/rspec/matchers/be_valid_mcp_class.rb', line 52 def description "be a valid MCP class#{type_constraint_message}" end |
#failure_message ⇒ Object
43 44 45 46 |
# File 'lib/model_context_protocol/rspec/matchers/be_valid_mcp_class.rb', line 43 def "expected #{@actual} to be a valid MCP class#{type_constraint_message}, but:\n" + @failure_reasons.map { |reason| " - #{reason}" }.join("\n") end |
#failure_message_when_negated ⇒ Object
48 49 50 |
# File 'lib/model_context_protocol/rspec/matchers/be_valid_mcp_class.rb', line 48 def "expected #{@actual} not to be a valid MCP class#{type_constraint_message}, but it was" end |
#matches?(actual) ⇒ Boolean
34 35 36 37 38 39 40 41 |
# File 'lib/model_context_protocol/rspec/matchers/be_valid_mcp_class.rb', line 34 def matches?(actual) @actual = actual @failure_reasons = [] validate_inheritance && validate_name_defined && validate_description_defined end |