Sha256: 216cb8816239c5047cd35f208f78c3a975dcb7afbd84de23e1ae26873905d397
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
module GovukAbTesting module AcceptanceTests class ActiveSupport attr_reader :request, :request_headers, :scope def initialize(scope) @request = scope.instance_variable_get(:@request) if @request.nil? raise "Couldn't find '@request' defined, are you using ActiveSupport test cases?" end @scope = scope @request_headers = {} @response = scope.instance_variable_get(:@response) end def set_header(name, value) request.headers[name] = value @request_headers[name] = value end def vary_header @response.headers['Vary'] end def analytics_meta_tags_for_test(ab_test_name) analytics_meta_tags.select { |tag| tag.for_ab_test?(ab_test_name) } end def analytics_meta_tags tags = scope.css_select(ANALYTICS_META_TAG_SELECTOR) tags.map do |tag| MetaTag.new( content: tag.attributes['content'].value, dimension: tag.attributes['data-analytics-dimension'].value ) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
govuk_ab_testing-2.2.0 | lib/govuk_ab_testing/acceptance_tests/active_support.rb |
govuk_ab_testing-2.1.0 | lib/govuk_ab_testing/acceptance_tests/active_support.rb |