class GovukAbTesting::Configuration

Constants

VALID_FRAMEWORKS

Attributes

config[RW]

Public Class Methods

new() click to toggle source
# File lib/govuk_ab_testing/configuration.rb, line 6
def initialize
  @config = {}
end

Public Instance Methods

acceptance_test_framework() click to toggle source
# File lib/govuk_ab_testing/configuration.rb, line 10
def acceptance_test_framework
  config[:acceptance_test_framework]
end
acceptance_test_framework=(framework) click to toggle source
# File lib/govuk_ab_testing/configuration.rb, line 14
def acceptance_test_framework=(framework)
  unless VALID_FRAMEWORKS.include?(framework)
    raise "Invalid acceptance test framework '#{framework}'"
  end

  config[:acceptance_test_framework] = framework
  @framework_class = nil
end
framework_class() click to toggle source
# File lib/govuk_ab_testing/configuration.rb, line 23
def framework_class
  @framework_class ||= begin
    case config[:acceptance_test_framework]
    when :capybara
      GovukAbTesting::AcceptanceTests::Capybara
    when :active_support
      GovukAbTesting::AcceptanceTests::ActiveSupport
    else
      raise "Invalid framework #{acceptance_test_framework}"
    end
  end
end