Module: Flakifier

Defined in:
lib/flake/flakifier.rb

Overview

Module included in the target class. Generates a new method with the appropriate flakiness parameters, then replaces the original with it with the .flakify method.

Instance Method Summary collapse

Instance Method Details

#flakify(method_name, error) ⇒ Object

TODO: Add ability to supply number of retries



8
9
10
11
12
13
14
15
16
# File 'lib/flake/flakifier.rb', line 8

def flakify(method_name, error)
  alias_method __original_method_name(method_name), method_name

  class_eval(__flaky_method(method_name, error))

  alias_method method_name, __flaky_method_name(method_name)

  self
end