Class: Suture::Surgeon::Auditor

Inherits:
Object
  • Object
show all
Includes:
Adapter::Log
Defined in:
lib/suture/surgeon/auditor.rb

Instance Method Summary collapse

Methods included from Adapter::Log

#log_debug, #log_error, #log_info, #log_warn, logger, reset!

Instance Method Details

#operate(plan) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/suture/surgeon/auditor.rb', line 8

def operate(plan)
  scalpel = Suture::Util::Scalpel.new
  new_result = scalpel.cut(plan, :new)
  old_result = scalpel.cut(plan, :old)
  if !plan.comparator.call(old_result, new_result)
    log_warn "      Seam \#{plan.name.inspect} is set to :call_both the :new and :old code\n      paths, but they did not match. The new result was: ```\n        \#{new_result.inspect}\n      ```\n      The old result was: ```\n        \#{old_result.inspect}\n      ```\n    MSG\n    if plan.raise_on_result_mismatch\n      raise Suture::Error::ResultMismatch.new(plan, new_result, old_result)\n    end\n  end\n  new_result\nend\n".gsub(/^ {10}/,'')