govuk_navigation_helpers 4.0.0 → 5.0.0
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
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: d4930be4a5498eeb6b86415ba59fca3ebcbb14e6
         | 
| 4 | 
            +
              data.tar.gz: c0f02bb16a2056a6e7fbcf19209ac01f54222c9b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3f5fba2c927c6d120277a1ec511ea6578d9ca85f582124a569212508cc13c580b1ee030aee06fdb6c0f2b426dab364c04efca497ca491670cf5657c958277e02
         | 
| 7 | 
            +
              data.tar.gz: 24a32d862aa6ca7579f6bb474e0295e9f2c97fc80aa2b0204102caab97b6b4cc7e4104c852aac7fa123c24f4f4df676703bf5729c6ac0be627ccf5ced08d725d
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,11 @@ | |
| 1 | 
            +
            ## 5.0.0
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            * **BREAKING CHANGE**: Update the gds-api-adapters gem. This includes a change
         | 
| 4 | 
            +
              which replaces the `GOVUK-Fact-Check-Id` header with the
         | 
| 5 | 
            +
              `GOVUK-Auth-Bypass-Id` header when passing on requests from the client to
         | 
| 6 | 
            +
              APIs. See the gds-api-adapters changelog for more information on upgrading.
         | 
| 7 | 
            +
            * Limit related links to the first two taxons.
         | 
| 8 | 
            +
             | 
| 1 9 | 
             
            ## 4.0.0
         | 
| 2 10 |  | 
| 3 11 | 
             
            * **BREAKING CHANGE**: remove `Guidance::DOCUMENT_TYPES`. Clients should use
         | 
| @@ -18,7 +18,7 @@ Gem::Specification.new do |spec| | |
| 18 18 | 
             
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         | 
| 19 19 | 
             
              spec.require_paths = ["lib"]
         | 
| 20 20 |  | 
| 21 | 
            -
              spec.add_runtime_dependency "gds-api-adapters", "~>  | 
| 21 | 
            +
              spec.add_runtime_dependency "gds-api-adapters", "~> 41.0"
         | 
| 22 22 |  | 
| 23 23 | 
             
              spec.add_development_dependency "bundler", "~> 1.6"
         | 
| 24 24 | 
             
              spec.add_development_dependency "rake", "~> 10.0"
         | 
| @@ -21,12 +21,15 @@ module GovukNavigationHelpers | |
| 21 21 |  | 
| 22 22 | 
             
                def taxons
         | 
| 23 23 | 
             
                  parent_taxons = @content_item.parent_taxons
         | 
| 24 | 
            -
             | 
| 24 | 
            +
             | 
| 25 | 
            +
                  parent_taxons.each_with_index.map do |parent_taxon, index|
         | 
| 26 | 
            +
                    related_content = index < 2 ? content_related_to(parent_taxon) : []
         | 
| 27 | 
            +
             | 
| 25 28 | 
             
                    {
         | 
| 26 29 | 
             
                      title: parent_taxon.title,
         | 
| 27 30 | 
             
                      url: parent_taxon.base_path,
         | 
| 28 31 | 
             
                      description: parent_taxon.description,
         | 
| 29 | 
            -
                      related_content:  | 
| 32 | 
            +
                      related_content: related_content,
         | 
| 30 33 | 
             
                    }
         | 
| 31 34 | 
             
                  end
         | 
| 32 35 | 
             
                end
         | 
| @@ -75,6 +75,54 @@ RSpec.describe GovukNavigationHelpers::TaxonomySidebar do | |
| 75 75 | 
             
                      ]
         | 
| 76 76 | 
             
                    )
         | 
| 77 77 | 
             
                  end
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                  it 'only shows related links for the first 2 taxons with related content' do
         | 
| 80 | 
            +
                    expect(GovukNavigationHelpers.configuration.statsd).to receive(
         | 
| 81 | 
            +
                      :increment
         | 
| 82 | 
            +
                    ).with(
         | 
| 83 | 
            +
                      :taxonomy_sidebar_searches
         | 
| 84 | 
            +
                    ).twice
         | 
| 85 | 
            +
             | 
| 86 | 
            +
                    content_item = content_item_tagged_to_taxon
         | 
| 87 | 
            +
             | 
| 88 | 
            +
                    content_item['links']['taxons'] << {
         | 
| 89 | 
            +
                      "title" => "Taxon C",
         | 
| 90 | 
            +
                      "base_path" => "/taxon-c",
         | 
| 91 | 
            +
                      "content_id" => "taxon-c",
         | 
| 92 | 
            +
                      "description" => "The C taxon."
         | 
| 93 | 
            +
                    }
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                    expect(sidebar_for(content_item)).to eq(
         | 
| 96 | 
            +
                      items: [
         | 
| 97 | 
            +
                        {
         | 
| 98 | 
            +
                          title: "Taxon A",
         | 
| 99 | 
            +
                          url: "/taxon-a",
         | 
| 100 | 
            +
                          description: "The A taxon.",
         | 
| 101 | 
            +
                          related_content: [
         | 
| 102 | 
            +
                            { 'title': 'Related item A', 'link': '/related-item-a', },
         | 
| 103 | 
            +
                            { 'title': 'Related item B', 'link': '/related-item-b', },
         | 
| 104 | 
            +
                            { 'title': 'Related item C', 'link': '/related-item-c', },
         | 
| 105 | 
            +
                          ],
         | 
| 106 | 
            +
                        },
         | 
| 107 | 
            +
                        {
         | 
| 108 | 
            +
                          title: "Taxon B",
         | 
| 109 | 
            +
                          url: "/taxon-b",
         | 
| 110 | 
            +
                          description: "The B taxon.",
         | 
| 111 | 
            +
                          related_content: [
         | 
| 112 | 
            +
                            { 'title': 'Related item A', 'link': '/related-item-a', },
         | 
| 113 | 
            +
                            { 'title': 'Related item B', 'link': '/related-item-b', },
         | 
| 114 | 
            +
                            { 'title': 'Related item C', 'link': '/related-item-c', },
         | 
| 115 | 
            +
                          ],
         | 
| 116 | 
            +
                        },
         | 
| 117 | 
            +
                        {
         | 
| 118 | 
            +
                          title: "Taxon C",
         | 
| 119 | 
            +
                          url: "/taxon-c",
         | 
| 120 | 
            +
                          description: "The C taxon.",
         | 
| 121 | 
            +
                          related_content: [],
         | 
| 122 | 
            +
                        },
         | 
| 123 | 
            +
                      ]
         | 
| 124 | 
            +
                    )
         | 
| 125 | 
            +
                  end
         | 
| 78 126 | 
             
                end
         | 
| 79 127 |  | 
| 80 128 | 
             
                context 'when Rummager raises an exception' do
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: govuk_navigation_helpers
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 5.0.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - GOV.UK Dev
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017-03- | 
| 11 | 
            +
            date: 2017-03-23 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: gds-api-adapters
         | 
| @@ -16,14 +16,14 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - "~>"
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: ' | 
| 19 | 
            +
                    version: '41.0'
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 24 | 
             
                - - "~>"
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: ' | 
| 26 | 
            +
                    version: '41.0'
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: bundler
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         |