Class: GovukAbTesting::Configuration
- Inherits:
-
Object
- Object
- GovukAbTesting::Configuration
- Defined in:
- lib/govuk_ab_testing/configuration.rb
Constant Summary collapse
- VALID_FRAMEWORKS =
%i[capybara active_support].freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #acceptance_test_framework ⇒ Object
- #acceptance_test_framework=(framework) ⇒ Object
- #framework_class ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 |
# File 'lib/govuk_ab_testing/configuration.rb', line 6 def initialize @config = {} end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
4 5 6 |
# File 'lib/govuk_ab_testing/configuration.rb', line 4 def config @config end |
Instance Method Details
#acceptance_test_framework ⇒ Object
10 11 12 |
# File 'lib/govuk_ab_testing/configuration.rb', line 10 def acceptance_test_framework config[:acceptance_test_framework] end |
#acceptance_test_framework=(framework) ⇒ Object
14 15 16 17 18 19 20 21 |
# 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 ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/govuk_ab_testing/configuration.rb', line 23 def framework_class @framework_class ||= 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 |