Class: CodeDrivenDevelopment::Rule::Validation

Inherits:
AbstractRule
  • Object
show all
Defined in:
lib/code_driven_development/rule/validation.rb

Instance Method Summary collapse

Methods inherited from AbstractRule

#initialize

Constructor Details

This class inherits a constructor from CodeDrivenDevelopment::Rule::AbstractRule

Instance Method Details

#capable?Boolean

Returns:

  • (Boolean)


4
5
6
7
8
# File 'lib/code_driven_development/rule/validation.rb', line 4

def capable?
  code.sexp_type == :call &&
    code.sexp_body[0].nil? &&
    code.sexp_body[1] == :validate
end

#testObject



10
11
12
# File 'lib/code_driven_development/rule/validation.rb', line 10

def test
  test_context << TestComponent::OneLineTest.new("should validate_#{type}_of :#{field}")
end