Module: Familia::Validation
- Defined in:
- lib/familia/validation.rb,
lib/familia/validation/validator.rb,
lib/familia/validation/expectations.rb,
lib/familia/validation/test_helpers.rb,
lib/familia/validation/command_recorder.rb
Defined Under Namespace
Modules: CommandRecorder, Config, FamiliaTestHelpers, TestHelpers Classes: ArgumentMatcher, AtomicityValidator, CommandExpectation, CommandExpectations, PatternExpectation, PerformanceAnalyzer, PipelineExpectation, TransactionExpectation, ValidationError, ValidationResult, Validator
Class Method Summary collapse
-
.analyze_performance(&block) ⇒ Object
Quick performance analysis.
-
.capture_commands(&block) ⇒ Object
Capture Redis commands without validation.
-
.register_middleware! ⇒ Object
Register validation middleware with Redis client.
-
.validate(options = {}, &block) ⇒ Object
Validate a block of code against expected Redis commands.
-
.validate_atomicity(options = {}, &block) ⇒ Object
Validate that code executes atomically.
-
.validator(options = {}) ⇒ Object
Quick access to main validator.
Class Method Details
.analyze_performance(&block) ⇒ Object
Quick performance analysis
81 82 83 84 |
# File 'lib/familia/validation.rb', line 81 def self.analyze_performance(&block) commands = capture_commands(&block) PerformanceAnalyzer.new(commands).analyze end |
.capture_commands(&block) ⇒ Object
Capture Redis commands without validation
74 75 76 77 78 |
# File 'lib/familia/validation.rb', line 74 def self.capture_commands(&block) CommandRecorder.start_recording block.call if block_given? CommandRecorder.stop_recording end |
.register_middleware! ⇒ Object
Register validation middleware with Redis client
87 88 89 90 91 92 93 |
# File 'lib/familia/validation.rb', line 87 def self.register_middleware! if defined?(RedisClient) RedisClient.register(CommandRecorder::Middleware) else warn "RedisClient not available - command recording will not work" end end |
.validate(options = {}, &block) ⇒ Object
Validate a block of code against expected Redis commands
64 65 66 |
# File 'lib/familia/validation.rb', line 64 def self.validate( = {}, &block) validator().validate(&block) end |
.validate_atomicity(options = {}, &block) ⇒ Object
Validate that code executes atomically
69 70 71 |
# File 'lib/familia/validation.rb', line 69 def self.validate_atomicity( = {}, &block) validator().validate_atomicity(&block) end |