Method: ApiValidator::Spec#run

Defined in:
lib/api-validator/spec.rb

#runObject



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/api-validator/spec.rb', line 132

def run
  before_hooks.each do |hook|
    if hook.respond_to?(:receiver) && hook.receiver == self
      # It's a method
      hook.call
    else
      # It's a block
      instance_eval(&hook)
    end
  end

  results = self.expectations.inject([]) do |memo, expectation|
    memo << expectation.run
  end

  self.validations.inject(Results.new(self, results)) do |memo, validation|
    memo.merge!(validation.run)
  end
end