Class: RspecContracts::PathValidator
- Inherits:
-
Object
- Object
- RspecContracts::PathValidator
- Defined in:
- lib/rspec_contracts/path_validator.rb
Class Method Summary collapse
Class Method Details
.operation_matches_request?(op, method, path) ⇒ Boolean
16 17 18 |
# File 'lib/rspec_contracts/path_validator.rb', line 16 def operation_matches_request?(op, method, path) op == op.root.request_operation(method.to_sym, path)&.operation_object end |
.validate_path(op, method, path) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/rspec_contracts/path_validator.rb', line 6 def validate_path(op, method, path) lookup_path = path.remove(RspecContracts.config.base_path) return if operation_matches_request?(op, method, lookup_path) msg = "#{method.upcase} #{path} does not resolve to #{op.operation_id}" raise RspecContracts::Error::PathValidation.new(msg) if RspecContracts.config.path_validation_mode == :raise RspecContracts.config.logger.error "Contract validation warning: #{msg}" end |