# File lib/abingo_sugar.rb, line 8
  def ab_test(abingo, test_name, alternatives = nil, options = {})
    if (Abingo.options[:enable_specification] && !params[test_name].nil?)
      choice = params[test_name]
    elsif (Abingo.options[:enable_override_in_session] && !session[test_name].nil?)
      choice = session[test_name]
    elsif (alternatives.nil?)
      choice = abingo.flip(test_name)
    else
      choice = abingo.test(test_name, alternatives, options)
    end

    if block_given?
      yield(choice)
    else
      choice
    end
  end