govuk_ab_testing 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/lib/govuk_ab_testing/minitest_helpers.rb +4 -13
- data/lib/govuk_ab_testing/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9ff58dec73e2ed3af500ce0c9f9883ce44366a08
         | 
| 4 | 
            +
              data.tar.gz: b8ea71471e420af109704ff84476cc00ddcb13f3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4acc9deda25396e9fe7e5d36af8b38e0aec3c35b7931d937e4b8fd75da39bfda6a110d1ebaf06de78a67c1b2225db2e06d3c49919791dac09a09b432e1cbff97
         | 
| 7 | 
            +
              data.tar.gz: 72339f5bec3f32c374f0a95f0e73ea8b006e404d8c689719f203958eddd973a1a7b22ce0f27494a53a4b8e2f013991cd69118c9cfd3d2df4420c32c65c4b8fe4
         | 
    
        data/README.md
    CHANGED
    
    | @@ -112,8 +112,7 @@ class PartyControllerTest < ActionController::TestCase | |
| 112 112 | 
             
              include GovukAbTesting::MinitestHelpers
         | 
| 113 113 |  | 
| 114 114 | 
             
              should "show the original " do
         | 
| 115 | 
            -
                 | 
| 116 | 
            -
                setup_ab_variant("your_ab_test_name", "B", analytics_dimension)
         | 
| 115 | 
            +
                setup_ab_variant("your_ab_test_name", "B") # optionally pass in a analytics dimension as the third argument
         | 
| 117 116 |  | 
| 118 117 | 
             
                get :show
         | 
| 119 118 |  | 
| @@ -13,16 +13,13 @@ module GovukAbTesting | |
| 13 13 | 
             
                  assert_equal ab_test.response_header, response.headers['Vary'], "You probably forgot to use `configure_response`"
         | 
| 14 14 |  | 
| 15 15 | 
             
                  unless args[:assert_meta_tag] == false
         | 
| 16 | 
            -
                     | 
| 17 | 
            -
             | 
| 18 | 
            -
                     | 
| 19 | 
            -
                      ab_test.meta_tag_name + ':' + requested_variant.variant_name,
         | 
| 20 | 
            -
                      args[:dimension],
         | 
| 21 | 
            -
                      "You probably forgot to add the `analytics_meta_tag`"
         | 
| 16 | 
            +
                    content = ab_test.meta_tag_name + ':' + requested_variant.variant_name
         | 
| 17 | 
            +
                    message = "You probably forgot to add the `analytics_meta_tag` to the views"
         | 
| 18 | 
            +
                    assert_select "meta[name='govuk:ab-test'][content='#{content}']", 1, message
         | 
| 22 19 | 
             
                  end
         | 
| 23 20 | 
             
                end
         | 
| 24 21 |  | 
| 25 | 
            -
                def setup_ab_variant(ab_test_name, variant, dimension)
         | 
| 22 | 
            +
                def setup_ab_variant(ab_test_name, variant, dimension = 300)
         | 
| 26 23 | 
             
                  ab_test = GovukAbTesting::AbTest.new(ab_test_name, dimension: dimension)
         | 
| 27 24 |  | 
| 28 25 | 
             
                  @request.headers[ab_test.request_header] = variant
         | 
| @@ -34,11 +31,5 @@ module GovukAbTesting | |
| 34 31 |  | 
| 35 32 | 
             
                  assert_select "meta[name='govuk:ab-test']", false
         | 
| 36 33 | 
             
                end
         | 
| 37 | 
            -
             | 
| 38 | 
            -
              private
         | 
| 39 | 
            -
             | 
| 40 | 
            -
                def assert_meta_tag(name, content, dimension, message)
         | 
| 41 | 
            -
                  assert_select "meta[name='#{name}'][content='#{content}'][data-analytics-dimension='#{dimension}']", 1, message
         | 
| 42 | 
            -
                end
         | 
| 43 34 | 
             
              end
         | 
| 44 35 | 
             
            end
         |