Module: Rigor::Rails::Helpers

Defined in:
lib/rigor/rails.rb

Instance Method Summary collapse

Instance Method Details

#treatment(test_name, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/rigor/rails.rb', line 13

def treatment(test_name, &block)
  test = Rigor::Test.find_by_name(test_name)
  treatment = test.random_treatment

  if block_given?
    capture(treatment, &block)
  else
    treatment
  end
end