Module: ApiValidator::Spec::SharedClassAndInstanceMethods
- Included in:
- ApiValidator::Spec, ApiValidator::Spec
- Defined in:
- lib/api-validator/spec.rb
Instance Method Summary collapse
- #describe(name, options = {}, &block) ⇒ Object (also: #context)
- #shared_example(name, &block) ⇒ Object
- #shared_examples ⇒ Object
- #validations ⇒ Object
Instance Method Details
#describe(name, options = {}, &block) ⇒ Object Also known as: context
25 26 27 28 29 |
# File 'lib/api-validator/spec.rb', line 25 def describe(name, = {}, &block) validation = self.new(name, .merge(:parent => self), &block) self.validations << validation validation end |
#shared_example(name, &block) ⇒ Object
17 18 19 |
# File 'lib/api-validator/spec.rb', line 17 def shared_example(name, &block) self.shared_examples[name] = block end |
#shared_examples ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/api-validator/spec.rb', line 7 def shared_examples @shared_examples ||= begin if self.respond_to?(:superclass) && self.superclass.respond_to?(:shared_examples) self.superclass.shared_examples || Hash.new else Hash.new end end end |
#validations ⇒ Object
21 22 23 |
# File 'lib/api-validator/spec.rb', line 21 def validations @validations ||= [] end |