diff --git a/Gemfile b/Gemfile index 705281e2bc..9fa5c25fbd 100644 --- a/Gemfile +++ b/Gemfile @@ -36,7 +36,6 @@ gem 'activerecord-session_store' # this repo, as all the gem is doing is wrapping OpenSSL. ############################################################## gem 'aes', github: 'chicks/aes' -gem 'algoliasearch' gem 'attr_encrypted', '~> 3.1' gem 'blind_index', '0.2.0' gem 'delayed_job_active_record' @@ -80,7 +79,6 @@ gem 'adal', github: 'moneyadviceservice/azure-activedirectory-library-for-ruby' gem 'cream', '2.1.8' gem 'dough-ruby', github: 'moneyadviceservice/dough', branch: 'PostMessages_v5.45' gem 'mas-cms-client', '1.20.1' -gem 'site_search', '0.3.0' # Tools gem 'action_plans', github: 'moneyadviceservice/action_plans', ref: 'edb52f8' gem 'advice_plans', '~> 4.1.1' diff --git a/Gemfile.lock b/Gemfile.lock index a2af40274b..6250ec8af6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -235,9 +235,6 @@ GEM rails (>= 4, < 5) recaptcha sass-rails - algoliasearch (1.19.2) - httpclient (~> 2.8, >= 2.8.3) - json (>= 1.5.1) angularjs-rails (1.2.26) arel (6.0.4) ast (2.4.0) @@ -450,7 +447,6 @@ GEM http-accept (1.7.0) http-cookie (1.0.4) domain_name (~> 0.5) - httpclient (2.8.3) i18n (0.9.5) concurrent-ruby (~> 1.0) i18n-js (3.0.0.mas) @@ -732,8 +728,6 @@ GEM site_prism (2.11) addressable (~> 2.4) capybara (~> 2.7) - site_search (0.3.0) - algoliasearch spreadsheet (1.2.8) ruby-ole sprockets (2.12.5) @@ -811,7 +805,6 @@ DEPENDENCIES advice_plans (~> 4.1.1) aes! agreements (~> 2.5.0) - algoliasearch attr_encrypted (~> 3.1) autoprefixer-rails better_errors @@ -902,7 +895,6 @@ DEPENDENCIES selenium-webdriver shoulda-matchers site_prism - site_search (= 0.3.0) statsd-ruby sucker_punch syslog-logger diff --git a/apiary.apib b/apiary.apib deleted file mode 100644 index 46a8721724..0000000000 --- a/apiary.apib +++ /dev/null @@ -1,282 +0,0 @@ -FORMAT: 1A -HOST: https://www.moneyadviceservice.org.uk - -# Money Advice Service -API for the Money Advice Service, to be consumed by the responsive frontend. - -# Group Categories -Category related resources of the **Money Advice Service**. - -## Categories Collection [/{locale}/categories.json] -A collection of categories including their subcategories - -+ Parameters - + locale = `en` (optional, string, `en`) ... Locale of the Categories. - + Values - + `en` - + `cy` - -### Retrieve all Categories [GET] -+ Response 200 (application/json) - - + Header - - Link: ; rel="alternate"; hreflang="cy" - - + Body - - [ - { - "id": "life-events", - "type": "category", - "title": "Life events", - "description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n", - "contents": [ - { - "id": "setting-up-home", - "type": "category", - "title": "Setting up home", - "description": "Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n", - "contents": [ - ] - }, - { - "id": "young-people-and-money", - "type": "category", - "title": "Leaving school or college", - "description": "", - "contents": [ - ] - }, - { - "id": "having-a-baby", - "type": "category", - "title": "Having a baby", - "description": "", - "contents": [ - ] - } - ] - }, - { - "id": "managing-your-money", - "type": "category", - "title": "Managing your money", - "description": "", - "contents": [ - { - "id": "managing-your-money-better", - "type": "category", - "title": "Managing your money", - "description": "How to take control of your money, make ends meet and make better financial decisions\n", - "contents": [ - ] - }, - { - "id": "how-to-review-or-reduce-borrowing", - "type": "category", - "title": "How to review or reduce borrowing", - "description": "Tips on cutting the cost of card debt, personal loans, car finance, catalogue or HP agreements and mortgage payments", - "contents": [ - ] - } - ] - }, - { - "id": "money-topics", - "type": "category", - "title": "Money topics", - "description": "", - "contents": [ - ] - }, - { - "id": "tools--resources", - "type": "category", - "title": "Tools & resources", - "description": "", - "contents": [ - ] - }, - { - "id": "news", - "type": "category", - "title": "News", - "description": "", - "contents": [ - ] - } - ] - -## Category [/{locale}/categories/{id}] -A single category object with all its details - -+ Parameters - + locale = `en` (optional, string, `en`) ... Locale of the Category. - + Values - + `en` - + `cy` - + id (required, string, `life-events`) ... ID of the Category. - -### Retrieve a Category [GET] -+ Response 200 (application/json) - - + Header - - Link: ; rel="canonical"; title="Life events", ; rel="alternate"; hreflang="cy"; title="Digwyddiadau bywyd" - - + Body - - { - "title": "Life events", - "description": "When big things happen - having a baby, losing your job, getting divorced or retiring\n - it helps to be in control of your money\n", - "id":"life-events", - "contents":[ - { - "id":"setting-up-home", - "type":"category", - "title":"Setting up home", - "description":"Deciding whether to rent or buy, working out what you can afford and managing\n money when sharing with others\n" - }, - { - "id":"how-much-rent-can-you-afford", - "type":"guide", - "title":"How much rent can you afford?", - "description":"When working out what rent you can afford, remember to factor in upfront costs and your ongoing bills once you've moved in" - } - ] - } - - -# Group Articles -Article related resources of the **Money Advice Service**. - -## Article [/{locale}/articles/{id}] -A single Article object with all its details - -+ Parameters - + locale = `en` (optional, string, `en`) ... Locale of the Article. - + Values - + `en` - + `cy` - + id (required, string, `where-to-go-to-get-free-debt-advice`) ... ID of the Article. - -### Retrieve an Article [GET] -+ Response 200 (application/json) - - + Header - - Link: ; rel="canonical"; title="Where to go to get free debt advice", ; rel="alternate"; hreflang="cy"; title="Ble i gael cyngor am ddim ynghylch dyled", ; rel="alternate"; title="Where to go to get free debt advice" - - + Body - - { - "title": "Where to go to get free debt advice", - "description": "Find out where you can get free, confidential help if you are struggling with debt", - "body": "

Watch out for companies that aren't charities

Look out for companies with misleading names that sound like debt charities but are actually commercial businesses.

Never ever pay for services from this type of company.

", - "categories": ["taking-control-of-debt"] - } - -# Group Action Plans -Action Plan related resources of the **Money Advice Service**. - -## Action Plan [/{locale}/action_plans/{id}] -A single Action Plan object with all its details - -+ Parameters - + locale = `en` (optional, string, `en`) ... Locale of the Action Plan. - + Values - + `en` - + `cy` - -### Retrieve an Action Plan [GET] -+ Response 200 (application/json) - - + Header - - Link: ; rel="canonical"; title="Action plan – Prepare for the cost of having a baby", ; rel="alternate"; hreflang="cy"; title="Cynllun gweithredu - Paratowch am y gost o gael babi - Gwasanaeth Cynghori Ariannol", ; rel="alterante"; title="Action plan – Prepare for the cost of having a baby" - - + Body - - { - "title": "Prepare for the cost of having a baby", - "description": "A handy action plan which can help with planning of the costs involved in having a new baby", - "body": "

Why?

Knowing how much everything costs will help you prepare for your new arrival and avoid any unexpected expenses.

", - "categories": ["budgeting-for-a-family","action-plans-having-a-baby"] - } - -# Group Static Pages -Static Page related resources of the **Money Advice Service**. - -## Static Page [/{locale}/static/{id}] -A single Static Page object with all its details - -+ Parameters - + locale = `en` (optional, string, `en`) ... Locale of the Static Page. - + Values - + `en` - + `cy` - -### Retrieve a Static Page [GET] -+ Response 200 (application/json) - - + Header - - Link: rel="alternate"; hreflang="en-GB"; title="Privacy policy", rel="alternate"; hreflang="cy-GB"; title="Polisi preifatrwydd" - - + Body - - { - "title": "Privacy Policy", - "description": "This privacy policy applies to 'the Money Advice Service'. This includes our telephone Money Advice Line, face-to-face appointment service and the Mon ...", - "body": "

This privacy policy applies to 'the Money Advice Service'. This includes our telephone Money Advice Line, face-to-face appointment service and the Money Advice Service website including the web-chat facility.

" - } - -#Group Search -Search related resources of the **Money Advice Service**. - -## Search [/{locale}/search?query={query_chain}] -A collection of search results - -+ Parameters - + locale = `en` (optional, string, `en`) ... Locale of the Search. - + Values - + `en` - + `cy` - + query_chain (string, `health+check+house`) ... query of the search. - -### Retrieve search results [GET] -+ Response 200 (application/json) - - + Header - - Link: ; rel="alternate"; hreflang="cy" - - + Body - - [ - { - "id": "manage-your-budget-after-redundancy", - "type": "action_plan", - "title": "Manage your budget after redundancy", - "description":"Use this step-by-step action plan to help you keep the household budget on track after redundancy." - }, - { - "id": "new-baby-why-budget", - "type": "article", - "title": "New baby – why budget?", - "description":"If you find yourself saying that more and more, especially if there's a new baby on the scene, it's probably time to draw up a household budget and start planning your spending." - }, - { - "id": "funeral-plans", - "title": "Funeral plans", - "type": "article", - "description":"A funeral plan is a way of paying for a future funeral today. Here are some things to bear in mind if you're thinking of taking one out." - }, - { - "id": "how-to-make-your-money-go-further", - "type": "action_plan", - "title": "How to make your money go further", - "description":"Follow this action plan to help you save money around the home and when you're out and about, making your hard-earned cash go that bit further." - } - ] diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 67cabd7323..c3824b7a67 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -48,12 +48,6 @@ def covid_banner_dismissed? helper_method :covid_banner_dismissed? - def display_search_box_in_header? - true - end - - helper_method :display_search_box_in_header? - def contact_panels_border_top? false end diff --git a/app/controllers/search_results_controller.rb b/app/controllers/search_results_controller.rb deleted file mode 100644 index 2e5a915af3..0000000000 --- a/app/controllers/search_results_controller.rb +++ /dev/null @@ -1,23 +0,0 @@ -class SearchResultsController < ApplicationController - include SearchResultsHelper - decorates_assigned :search_results, with: SearchResultCollectionDecorator - - def index - return if params[:query].blank? - - @search_results = SiteSearch::Query.new( - params[:query], - options: { - index: 'pages', - highlightPreTag: '', - highlightPostTag: '', - page: index_zero_page, - hitsPerPage: 10 - } - ).results - - return render 'search_results/index_with_results' if @search_results.any? - - render 'search_results/index_no_results' - end -end diff --git a/app/controllers/styleguide_controller.rb b/app/controllers/styleguide_controller.rb index b87c1c5e7c..9a0057da81 100644 --- a/app/controllers/styleguide_controller.rb +++ b/app/controllers/styleguide_controller.rb @@ -23,10 +23,6 @@ def contact_panels_border_top? render layout: 'styleguide/page_unconstrained' end - def pages_search_results - render layout: 'styleguide/page' - end - def pages_parent_category_page render layout: 'styleguide/page' end diff --git a/app/decorators/search_result_collection_decorator.rb b/app/decorators/search_result_collection_decorator.rb deleted file mode 100644 index a2f0140a51..0000000000 --- a/app/decorators/search_result_collection_decorator.rb +++ /dev/null @@ -1,35 +0,0 @@ -class SearchResultCollectionDecorator < Draper::CollectionDecorator - delegate :per_page, :number_of_pages - - def decorator_class - SearchResultDecorator - end - - def context - { query: object.query } - end - - delegate :page, to: :object - - def first_page? - page == 1 - end - - def last_page? - page == number_of_pages - end - - def previous_page - first_page? ? nil : object.page - 1 - end - - def next_page - last_page? ? nil : object.page + 1 - end - - private - - def search_path(query) - h.search_results_path(query: query, locale: I18n.locale) - end -end diff --git a/app/decorators/search_result_decorator.rb b/app/decorators/search_result_decorator.rb deleted file mode 100644 index cc52f0f638..0000000000 --- a/app/decorators/search_result_decorator.rb +++ /dev/null @@ -1,29 +0,0 @@ -class SearchResultDecorator < Draper::Decorator - delegate :link - - def to_partial_path - 'search_result' - end - - def title - object.title.sub(Regexp.union(title_suffix_regexps), '').html_safe - end - - def description - object.description.to_s.gsub(//, '').html_safe - end - - private - - def title_suffix_regexps - title = h.t('layouts.base.title') - length = title.length - - length.times.map do |i| - is_truncated = i < (length - 1) - - Regexp.new(' - %s%s$' % { suffix: title[0..i], - ellipsis: is_truncated ? ' ...' : nil }) - end - end -end diff --git a/app/views/home/show.html.erb b/app/views/home/show.html.erb index 8d07f4c756..523d3a73db 100644 --- a/app/views/home/show.html.erb +++ b/app/views/home/show.html.erb @@ -1,18 +1,3 @@ -<% content_for :head do %> - -<% end %> - <% set_meta_tags(canonical: root_url, alternate: alternate_home_map, title: t('.title'), diff --git a/app/views/search_results/_pagination.html.erb b/app/views/search_results/_pagination.html.erb deleted file mode 100644 index db71accc1b..0000000000 --- a/app/views/search_results/_pagination.html.erb +++ /dev/null @@ -1,19 +0,0 @@ - diff --git a/app/views/search_results/_search_result.html.erb b/app/views/search_results/_search_result.html.erb deleted file mode 100644 index 07de191ff6..0000000000 --- a/app/views/search_results/_search_result.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -
  • - <%= heading_tag(level: 2, class: 'search-results__heading') do %> - <%= link_to search_result.title, search_result.link %> - <% end %> - -

    <%= search_result.description %>

    -
  • diff --git a/app/views/search_results/index.html.erb b/app/views/search_results/index.html.erb deleted file mode 100644 index 0e33aed50a..0000000000 --- a/app/views/search_results/index.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -<% set_meta_tags(title: t('.document_title'), - robots: 'noindex') %> - -
    -
    -
    - <%= heading_tag t('.page_title') %> - -
    - <%= render 'shared/search', search_in_page_header: false %> -
    -
    -
    -
    diff --git a/app/views/search_results/index_no_results.html.erb b/app/views/search_results/index_no_results.html.erb deleted file mode 100644 index 86ee89c810..0000000000 --- a/app/views/search_results/index_no_results.html.erb +++ /dev/null @@ -1,22 +0,0 @@ -<% set_meta_tags(title: t('.document_title', query: params[:query]), - robots: 'noindex') %> - - - -
    -
    -
    - <%= heading_tag t('.page_title_html', query: params[:query]) %> - -
    - <%= render 'shared/search', search_in_page_header: false %> -

    <%= t('.body') %>

    -
    -
    -
    -
    diff --git a/app/views/search_results/index_with_results.html.erb b/app/views/search_results/index_with_results.html.erb deleted file mode 100644 index 184b5e858c..0000000000 --- a/app/views/search_results/index_with_results.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<% set_meta_tags(title: t('.document_title', query: params[:query]), - robots: 'noindex') %> - -
    -
    -
    - <%= heading_tag t('.page_title_html', query: params[:query]) %> - -
    - <%= render 'shared/search', search_in_page_header: false %> -
      - <%= render partial: 'search_result', collection: search_results %> -
    - <%= render 'pagination', search_results: search_results %> -
    -
    -
    -
    diff --git a/app/views/shared/_search.html.erb b/app/views/shared/_search.html.erb deleted file mode 100644 index 1dfe7b82d1..0000000000 --- a/app/views/shared/_search.html.erb +++ /dev/null @@ -1,26 +0,0 @@ - diff --git a/config/initializers/algolia_setup.rb b/config/initializers/algolia_setup.rb deleted file mode 100644 index 002b9fa135..0000000000 --- a/config/initializers/algolia_setup.rb +++ /dev/null @@ -1,2 +0,0 @@ -Algolia.init application_id: ENV['ALGOLIA_APP_ID'], - api_key: ENV['ALGOLIA_API_KEY'] diff --git a/config/initializers/site_search.rb b/config/initializers/site_search.rb deleted file mode 100644 index 1a8f27c8b4..0000000000 --- a/config/initializers/site_search.rb +++ /dev/null @@ -1,4 +0,0 @@ -SiteSearch.config do |config| - config.adapter = :algolia - config.logger = Rails.logger -end diff --git a/config/routes.rb b/config/routes.rb index b1fb574a7d..5e55e72d5c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -130,7 +130,6 @@ def not_implemented page_type: /home_pages/ resources :categories, only: 'show' - resources :search_results, only: 'index', path: 'search' resources :videos, only: :show resources :corporate_categories, only: [:show], constraints: CorporateCategoriesConstraint.new diff --git a/features/search.feature b/features/search.feature deleted file mode 100644 index d4d002b903..0000000000 --- a/features/search.feature +++ /dev/null @@ -1,51 +0,0 @@ -@wip -Feature: Searching on MAS site - As a user visiting the website - I want to search by keyword - So that I can find the content I am looking for - - Background: - Given I am on the home page - - Scenario: Search on first result page - When I search the query "money" - Then I should see "10" results - And I should see the search results - | title | - | Money Advice Toolkits | - | Our board | - | Money lives: Paul | - And I should be on page "1" of "34" of the search results - And I should not see the previous button - - Scenario: Search and navigate to the next result page - When I search the query "money" - And I go to the next results page - Then I should see "10" results - And I should see the search results - | title | - | Debt advice evaluation toolkit | - And I should be on page "2" of "34" of the search results - - Scenario: Search and navigate to last result page - When I search the query "money" - And I go to the last page of results - Then I should be on page "34" of "34" of the search results - And I should see the search results - | title | - | Council Tax: what it is, what it costs and how to save money | - And I should not see the next button - - Scenario: Search and navigate to a previous result page - When I search the query "money" - And I go to the last page of results - And I go to the previous results page - Then I should see "10" results - And I should see the search results - | title | - | UK could gain £108 billion from improved money management | - And I should be on page "33" of "34" of the search results - - Scenario: Search with no results - When I search the query "Norris" - Then I should see no search results for "Norris" diff --git a/features/step_definitions/search_page_steps.rb b/features/step_definitions/search_page_steps.rb deleted file mode 100644 index a215348c12..0000000000 --- a/features/step_definitions/search_page_steps.rb +++ /dev/null @@ -1,87 +0,0 @@ -When('I search the query {string}') do |query| - home_page.search_box.input.set(query) - home_page.search_box.submit.click -end - -When('I go to the next results page') do - search_results_page.pagination.next_button.click -end - -When( - 'I go to results page {string} of the {string} search query' -) do |page, query| - visit("/en/search?query=#{query}&page=#{page}") -end - -When('I should not see the next button') do - expect(search_results_page.pagination).to_not have_next_button -end - -When('I go to the previous results page') do - expect(search_results_page.pagination).to have_previous_button - search_results_page.pagination.previous_button.click -end - -When(/^I search for something irrelevant$/) do - home_page.search_box.input.set 'tiger' - home_page.search_box.submit.click -end - -When("I submit a search with no query") do - home_page.search_box.input.set '' - home_page.search_box.submit.click -end - -When("I go to the last page of results") do - step %{I go to results page "34" of the "money" search query} -end - -Then("the search results page should have a robots tag with value noindex") do - expect { search_results_page.robots_tag[:content] }.to become('noindex') -end - -Then("I should see the search results") do |table| - results = search_results_page.results.map { |result| result.text }.join("\n") - - table.rows.each do |row| - expect(results).to include(row[0]) - end -end - -When("I search for something relevant") do - step %{I search the query "money"} -end - -Then('I should see no search results for {string}') do |query| - expected_heading = strip_tags( - I18n.t('search_results.index_no_results.page_title_html', query: query) - ) - - document_title = I18n.t( - 'search_results.index_no_results.document_title', query: query - ) - base_title = I18n.t('layouts.base.title') - - expected_title = "#{document_title} - #{base_title}" - - expect(search_results_page.title).to eq(expected_title) - expect(search_results_page.heading).to have_content(expected_heading) - expect(search_results_page).to have_no_results -end - -Then( - 'I should be on page {string} of {string} of the search results' -) do |page, number_of_pages| - expect( - search_results_page.pagination.text - ).to include("Page #{page} of #{number_of_pages}") -end - -Then('I should not see the previous button') do - expect(search_results_page.pagination).to_not have_previous_button -end - -Then('I should see {string} results') do |results_size| - expect(search_results_page.results.size).to be(results_size.to_i) -end - diff --git a/features/support/vcr.rb b/features/support/vcr.rb index 24b4995d1c..6d6a493b22 100644 --- a/features/support/vcr.rb +++ b/features/support/vcr.rb @@ -17,21 +17,12 @@ "/CMS/#{request.method}#{uri.path}#{uri.query}" end - if uri.host =~ /algolia/ - query = JSON.parse(request.body)['params'] - cassette_name = "/algolia/#{request.method}#{uri.path}#{uri.query}/#{query}" - VCR.use_cassette(cassette_name, match_requests_on: [:body], &request) - elsif VCR.current_cassette && VCR.current_cassette.name == cassette_name + if VCR.current_cassette && VCR.current_cassette.name == cassette_name request.proceed else VCR.use_cassette(cassette_name, &request) end end - c.filter_sensitive_data('') { ENV['ALGOLIA_API_KEY'] } - c.filter_sensitive_data('') { ENV['ALGOLIA_APP_ID'] } c.filter_sensitive_data('') { ENV['CAR_COST_TOOL_CAP_PASSWORD'] } end - -Algolia.init application_id: ENV['ALGOLIA_APP_ID'], - api_key: ENV['ALGOLIA_API_KEY'] diff --git a/lib/core.rb b/lib/core.rb index 175891a085..d3c34061a4 100644 --- a/lib/core.rb +++ b/lib/core.rb @@ -21,8 +21,6 @@ module ConnectionFactory autoload :Entity, 'core/entity' autoload :Footer, 'core/entity/footer' autoload :Other, 'core/entity/other' - autoload :SearchResult, 'core/entity/search_result' - autoload :SearchResultCollection, 'core/entity/search_result_collection' autoload :StaticPage, 'core/entity/static_page' autoload :Customer, 'core/entity/customer' autoload :WebChat, 'core/entity/web_chat' diff --git a/lib/core/entity/search_result.rb b/lib/core/entity/search_result.rb deleted file mode 100644 index e326000602..0000000000 --- a/lib/core/entity/search_result.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Core - class SearchResult < Entity - attr_accessor :title, :link, :snippet - - validates_presence_of :title - end -end diff --git a/lib/core/repository/search/content_service.rb b/lib/core/repository/search/content_service.rb deleted file mode 100644 index 540cf40158..0000000000 --- a/lib/core/repository/search/content_service.rb +++ /dev/null @@ -1,34 +0,0 @@ -module Core::Repository - module Search - class ContentService < Core::Repository::Base - LIMIT = 25 - EVENT_NAME = 'request.content-service.search'.freeze - - def initialize - self.connection = Core::Registry::Connection[:content_service] - end - - def perform(query) - options = { query: query, locale: I18n.locale, limit: LIMIT } - response = ActiveSupport::Notifications.instrument(EVENT_NAME, options) do - connection.get('search.json', options) - end - - response.body['searchResults'].map do |result_data| - { - id: result_data['id'], - title: result_data['preview']['title'], - description: result_data['preview']['preview'] || result_data['preview']['description'], - type: result_data['type'] - } - end - rescue Core::Connection::Http::ConnectionFailed, Core::Connection::Http::ClientError - raise RequestError, 'Unable to fetch Search Results JSON from Content Service' - end - - private - - attr_accessor :connection - end - end -end diff --git a/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_0_hitsPerPage_10_query_Foobar.yml b/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_0_hitsPerPage_10_query_Foobar.yml deleted file mode 100644 index 4b9cd6cc47..0000000000 --- a/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_0_hitsPerPage_10_query_Foobar.yml +++ /dev/null @@ -1,58 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://bhpslyij2l-dsn.algolia.net/1/indexes/pages/query - body: - encoding: UTF-8 - string: '{"params":"highlightPreTag=%3Cb%3E\u0026highlightPostTag=%3C%2Fb%3E\u0026page=0\u0026hitsPerPage=10\u0026query=Foobar"}' - headers: - User-Agent: - - Algolia for Ruby 1.19.2 - Accept: - - "*/*" - Accept-Encoding: - - gzip,deflate - Date: - - Tue, 05 Feb 2019 11:21:42 GMT - X-Algolia-Api-Key: - - "" - X-Algolia-Application-Id: - - "" - Content-Type: - - application/json; charset=utf-8 - response: - status: - code: 200 - message: OK - headers: - Server: - - nginx - Date: - - Tue, 05 Feb 2019 11:21:42 GMT - Content-Type: - - application/json; charset=UTF-8 - Content-Length: - - '221' - Connection: - - keep-alive - X-Alg-Pt: - - '1' - Access-Control-Allow-Origin: - - "*" - Timing-Allow-Origin: - - "*" - Cache-Control: - - no-cache - X-Content-Type-Options: - - nosniff - Content-Disposition: - - inline; filename=a.txt - body: - encoding: UTF-8 - string: '{"hits":[],"nbHits":0,"page":0,"nbPages":0,"hitsPerPage":10,"processingTimeMS":1,"exhaustiveNbHits":true,"query":"Foobar","params":"highlightPreTag=%3Cb%3E&highlightPostTag=%3C%2Fb%3E&page=0&hitsPerPage=10&query=Foobar"} - -' - http_version: - recorded_at: Tue, 05 Feb 2019 11:21:42 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_0_hitsPerPage_10_query_How_to_budget_for_a_monthly_benefit_payment.yml b/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_0_hitsPerPage_10_query_How_to_budget_for_a_monthly_benefit_payment.yml deleted file mode 100644 index 9f181a6462..0000000000 --- a/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_0_hitsPerPage_10_query_How_to_budget_for_a_monthly_benefit_payment.yml +++ /dev/null @@ -1,155 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://bhpslyij2l-dsn.algolia.net/1/indexes/pages/query - body: - encoding: UTF-8 - string: '{"params":"highlightPreTag=%3Cb%3E\u0026highlightPostTag=%3C%2Fb%3E\u0026page=0\u0026hitsPerPage=10\u0026query=How+to+budget+for+a+monthly+benefit+payment"}' - headers: - User-Agent: - - Algolia for Ruby 1.19.2 - Accept: - - "*/*" - Accept-Encoding: - - gzip,deflate - Date: - - Tue, 05 Feb 2019 11:21:44 GMT - X-Algolia-Api-Key: - - "" - X-Algolia-Application-Id: - - "" - Content-Type: - - application/json; charset=utf-8 - response: - status: - code: 200 - message: OK - headers: - Server: - - nginx - Date: - - Tue, 05 Feb 2019 11:21:44 GMT - Content-Type: - - application/json; charset=UTF-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Alg-Pt: - - '1' - Access-Control-Allow-Origin: - - "*" - Timing-Allow-Origin: - - "*" - Cache-Control: - - no-cache - X-Content-Type-Options: - - nosniff - Content-Disposition: - - inline; filename=a.txt - Content-Encoding: - - gzip - body: - encoding: UTF-8 - string: '{"hits":[{"title":"How to budget for a monthly benefit payment","description":"A - single monthly Universal Credit payment means you''ll need to get to grips - with your household budget - here''s how to do it","content":"

    Feeling - out of control when it comes to money can be scary, especially if you don’t - know whether you’ve got enough to live on. Getting a single monthly Universal - Credit payment might be making you even more nervous about keeping your head - above water. The only way to manage your money is to draw up a household budget.

    \n\n
    \n ?\n

    Living - in Northern Ireland?

    \n\n

    Universal Credit works differently in Northern - Ireland. Find out more on the nidirect website.

    \n\n
    \n\n\n

    Why budget - – why now?

    \n\n
    \n ?\n

    Living in Scotland?

    \n\n

    You might - be offered some choices about how your Universal Credit is paid. Read our - guide to Universal - Credit in Scotland.

    \n\n
    \n\n

    Drawing up a budget of all your - household income and outgoings is a must if you want to make sure you can - pay all your bills and manage until the end of the month.

    \n\n

    Even if - you’re already budgeting, changes to the benefit system will probably mean - you need to make some changes to the way you go about it.

    \n\n

    Just to - remind you, the following benefits:

    \n\n
      \n
    • Income Support
    • \n
    • Child - Tax Credit
    • \n
    • Housing Benefit
    • \n
    • Working Tax Credit
    • \n
    • Income-based - Jobseekers Allowance
    • \n
    • Income-related Employment and Support Allowance
    • \n
    \n\n

    are - being phased out for people of working age and replaced with Universal Credit.

    \n\n

    Universal - Credit will be paid in a single monthly payment to each household.

    \n\n

    So - if you currently work out your budget weekly or fortnightly, you’ll have to - start looking at your incomings and outgoings across the whole month

    \n\n

    And - if you’re using different benefit payments to cover set expenses, you’ll need - to get used to having a single payment to cover everything

    \n\n

    Universal - Credit is already available for single people, couples and families in some - areas of the country.

    \n\n

    It mostly affects people who are newly unemployed. - If you’re already claiming benefits you will be told when Universal Credit - will affect you.

    \n\n

    In the meantime, it makes sense to get ready for - the changes by getting to grips with a monthly budget.

    \n\n\n\n

    Drawing up your budget – where - to start

    \n\n
    \n \n \n \n \n \n

    Get personalised - help to budget for monthly Universal Credit payments with our Money - Manager tool.

    \n\n
    \n\n

    Despite how daunting it might sound, - a budget is just two lists:

    \n\n
      \n
    1. Money you have coming in (from - things like your benefit payments and your salary if you’re working).
    2. \n
    3. Payments - that you make (such as your rent or mortgage, heating bills and insurance, - as well as living expenses and regular and irregular spending).
    4. \n
    \n\n

    How to work out your income

    \n\n
    \n ?\n

    Did - you know?

    \n\n

    Four in five people who set a budget stick to - it most of the time. Keeping to a budget gives you peace of mind and helps - you to stay in control of your money.

    \n\n

    Source: Money Advice - Service research (2014)

    \n\n
    \n\n
      \n
    • \nBenefits. - Look at the paperwork relating to any benefits and tax credits you get at - the moment. Jot down the amounts you get. Make sure you make a note of whether - these payments are weekly, fortnightly, four-weekly or monthly.
    • \n
    • \nWages. - If you’re working, check your payslips and jot down your salary (after tax - and other deductions).
    • \n
    • \nOther income. If you - have any other income coming in, for example from a pension or child maintenance - from your ex-partner, write down the amounts and how often you get them.
    • \n
    \n\n

    Don’t - worry if the money you have coming in changes from time to time.

    \n\n

    The - budget we’ll help you draw up will be easy to adjust without you having to - start from scratch every time.

    \n\n

    How - to work out your outgoings

    \n\n
      \n
    • \nHousehold bills: - Gather together all the bills you pay so you can see the exact amounts. If - your rent is currently being paid for you, be prepared to start including - this in your budget soon. With Universal Credit, you’ll have to start paying - your landlord yourself.
    • \n
    • \nLiving costs: The more - exact you can be here, the better. For things like grocery shopping, it’s - probably enough to look at how much you spend across a few weeks and work - out an average. But for things like school uniform and other one-off costs, - you’ll need to look at what you spend across the whole year and divide by - 12 to get an average monthly amount.
    • \n
    • \nInsurance and loan - repayments: Track down anything you pay on a regular basis such as - home insurance, catalogue payments and credit card payments and make a note - of them.
    • \n
    • \nChildren and pets: This includes things - like childcare, after-school clubs, and school trips. Some of these costs - will be regular and others will be occasional so you’ll need to work out an - average. If you have pets, add up everything you spend on their food, vets’ - bills, etc.
    • \n
    • \nTravel: If you have a car, make - sure you include all the costs (including some like car tax – commonly known - as road tax – that you only pay ye","published_at":"2017-10-09T13:31:34.000Z","objectID":"/en/articles/how-to-budget-for-a-monthly-benefit-payment","_highlightResult":{"title":{"value":"How - to budget for a monthly benefit - payment","matchLevel":"full","fullyHighlighted":true,"matchedWords":["how","to","budget","for","a","monthly","benefit","payment"]},"description":{"value":"A - single monthly Universal Credit payment means you''ll need to - get to grips with your household budget - here''s how - to do it","matchLevel":"partial","fullyHighlighted":false,"matchedWords":["how","to","budget","a","monthly","payment"]}}}],"nbHits":1,"page":0,"nbPages":1,"hitsPerPage":10,"processingTimeMS":1,"exhaustiveNbHits":true,"query":"How - to budget for a monthly benefit payment","params":"highlightPreTag=%3Cb%3E&highlightPostTag=%3C%2Fb%3E&page=0&hitsPerPage=10&query=How+to+budget+for+a+monthly+benefit+payment"} - -' - http_version: - recorded_at: Tue, 05 Feb 2019 11:21:44 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_0_hitsPerPage_10_query_Sut_i_gyllidebu_ar_gyfer_taliad_budd-daliadau_misol.yml b/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_0_hitsPerPage_10_query_Sut_i_gyllidebu_ar_gyfer_taliad_budd-daliadau_misol.yml deleted file mode 100644 index d4fe3c1b45..0000000000 --- a/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_0_hitsPerPage_10_query_Sut_i_gyllidebu_ar_gyfer_taliad_budd-daliadau_misol.yml +++ /dev/null @@ -1,154 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://bhpslyij2l-dsn.algolia.net/1/indexes/pages/query - body: - encoding: UTF-8 - string: '{"params":"highlightPreTag=%3Cb%3E\u0026highlightPostTag=%3C%2Fb%3E\u0026page=0\u0026hitsPerPage=10\u0026query=Sut+i+gyllidebu+ar+gyfer+taliad+budd-daliadau+misol"}' - headers: - User-Agent: - - Algolia for Ruby 1.19.2 - Accept: - - "*/*" - Accept-Encoding: - - gzip,deflate - Date: - - Tue, 05 Feb 2019 11:21:46 GMT - X-Algolia-Api-Key: - - "" - X-Algolia-Application-Id: - - "" - Content-Type: - - application/json; charset=utf-8 - response: - status: - code: 200 - message: OK - headers: - Server: - - nginx - Date: - - Tue, 05 Feb 2019 11:21:46 GMT - Content-Type: - - application/json; charset=UTF-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - X-Alg-Pt: - - '1' - Access-Control-Allow-Origin: - - "*" - Timing-Allow-Origin: - - "*" - Cache-Control: - - no-cache - X-Content-Type-Options: - - nosniff - Content-Disposition: - - inline; filename=a.txt - Content-Encoding: - - gzip - body: - encoding: UTF-8 - string: '{"hits":[{"title":"Sut i gyllidebu ar gyfer taliad budd-daliadau misol","description":"Mae - taliad Credyd Cyffredinol misol sengl yn golygu y bydd angen ichi fynd i’r - afael â chyllideb eich cartref - dyma sut i’w wneud","content":"

      Gall - y teimlad o fod allan o reolaeth gyda’ch arian fod yn un dychrynllyd, yn enwedig - os nad ydych yn sicr fod gennych ddigon i fyw arno. Mae’n bosib fod cael un - taliad Credyd Cynhwysol misol yn eich gwneud yn fwy pryderus fyth ynglŷn â - chadw dau ben llinyn ynghyd. Yr unig ffordd i reoli’ch arian yw llunio cyllideb - cartref.

      \n\n
      \n ?\n

      Yn byw yng Ngogledd Iwerddon?

      \n\n

      Mae - Credyd Cynhwysol yn gweithio’n wahanol yng Ngogledd Iwerddon. Dysgwch ragor - ar wefan - nidirect.

      \n\n
      \n\n\n

      Pam - cyllidebu – pam nawr?

      \n\n
      \n ?\n

      Yn byw yn yr - Alban?

      \n\n

      Efallai y cewch gynnig rhai dewisiadau ynghylch sut y telir - eich Credyd Cynhwysol. Darllenwch ein canllaw ar Gredyd - Cynhwysol yn yr Alban.

      \n\n
      \n\n

      Mae llunio cyllideb o holl - incwm a chostau eich cartref yn allweddol os ydych eisiau sicrhau y gallwch - dalu’ch holl filiau ac ymdopi hyd at ddiwedd y mis.

      \n\n

      Hyd yn oed os - ydych chi eisoes yn creu cyllideb, bydd newidiadau i’r system fudd-daliadau - yn debygol o olygu fod angen i chi wneud rhai newidiadau i sut ydych yn mynd - ati i wneud hyn.

      \n\n

      I’ch atgoffa, mae’r budd-daliadau canlynol:

      \n\n
        \n
      • Lwfans - Ceisio Gwaith yn Seiliedig ar Incwm
      • \n
      • Lwfans Cyflogaeth a Chymorth - yn gysylltiedig ag incwm
      • \n
      • Cymhorthdal Incwm
      • \n
      • Credyd - Treth Plant
      • \n
      • Credyd Treth Gwaith
      • \n
      • Budd-dal Tai
      • \n
      \n\n

      yn - cael eu dirwyn i ben yn raddol i bobl o oed gwaith a bydd y Credyd Cynhwysol - yn cymryd eu lle.

      \n\n

      Bydd y Credyd Cynhwysol yn cael ei dalu mewn un - taliad misol i bob cartref.

      \n\n
        \n
      • Felly os ydych yn cyfrifo eich - cyllideb yn wythnosol neu bob pythefnos ar hyn o bryd, bydd - angen i chi ddechrau edrych ar eich incwm a gwariant i gyd dros fis cyfan.
      • \n
      • Ac - os ydych chi’n defnyddio taliadau gwahanol fudd-daliadau - i dalu am gostau penodol, bydd angen i chi ddod i arfer â chael un taliad - i dalu am bopeth.
      • \n
      \n\n

      Mae Credyd Cynhwysol ar gael eisoes i - bobl sengl, cyplau a theuluoedd mewn rhai ardaloedd o’r wlad. Mae’n effeithio - fwyaf ar y bobl sydd newydd ddod yn ddi-waith.

      \n\n

      Os ydych eisoes yn - hawlio budd-daliadau cewch wybod pa bryd fydd Credyd Cynhwysol yn effeithio - arnoch chi.

      \n\n
        \n
      • Dysgwch fwy am pryd fydd y newid yn digwydd - yn ein canllaw Egluro - Credyd Cynhwysol.
      • \n
      • Cewch amcangyfrif o faint o Gredyd Cynhwysol - y bydd gennych hawl i’w gael – yn cynnwys faint yn well eich byd fyddwch chi - mewn gwaith – gyda’r gyfrifiannell hon ar wefan Policy in Practiceopens - in new window.
      • \n
      \n\n

      Llunio’ch - cyllideb – ble i ddechrau

      \n\n
      \n \n \n \n \n \n

      Ceisiwch - help personol i gyllidebu ar gyfer taliadau Credyd Cynhwysol misol gyda’n - hofferyn Rheolwr - Arian.

      \n\n
      \n\n

      Er y gallai hyn fod yn syniad brawychus, yr - oll yw cyllideb yw dwy restr:

      \n\n
        \n
      1. Arian sydd gennych yn dod - i mewn (o bethau fel taliadau budd-daliadau a’ch cyflog os ydych yn gweithio).
      2. \n
      3. Taliadau - a wneir gennych (megis eich rhent neu forgais, biliau gwresogi ac yswiriant, - yn ogystal â chostau byw a gwariant rheolaidd ac afreolaidd).
      4. \n
      \n\n

      Sut i gyfrifo’ch incwm

      \n\n
        \n
      • \nBudd-daliadau. - Edrychwch ar y gwaith papur yn ymwneud ag unrhyw fudd-daliadau a chredydau - treth a gewch ar hyn o bryd. Nodwch faint ydych yn ei gael. Sicrhewch eich - bod yn gwneud nodyn a yw’r taliadau hyn yn wythnosol, bob pythefnos, pob pedair - wythnos neu’n fisol.
      • \n
      • \nCyflog. Os ydych chi’n - gweithio, gwiriwch eich slipiau cyflog a nodi’ch cyflog (ar ôl treth a didyniadau - eraill).
      • \n
      • \nIncwm arall. Os oes gennych unrhyw - incwm arall yn dod i mewn, er enghraifft, o bensiwn neu gynhaliaeth plant - gan eich cyn bartner, nodwch y symiau a pha mor aml fyddwch chi’n eu cael.
      • \n
      \n\n

      Peidiwch - â phoeni os bydd yr arian a ddaw i mewn yn newid o bryd i’w gilydd. Bydd y - gyllideb y byddwn yn helpu i’w llunio yn hawdd i’w haddasu heb i chi orfod - dechrau o’r dechrau bob tro.

      \n\n

      Sut - i gyfrifo’ch costau

      \n\n
        \n
      • \nBiliau’r cartref. - Casglwch yr holl filiau y byddwch yn eu talu ynghyd fel eich bod yn gallu - gweld yr union symiau. Os yw’ch rhent yn cael ei dalu i chi ar hyn o bryd, - byddwch yn barod i ddechrau cynnwys hyn yn eich cyllideb yn fuan. Gyda Chredyd - Cynhwysol, bydd rhaid i chi ddechrau talu eich landlord eich hun.
      • \n
      • \nCostau - byw. Gorau oll os gallwch fod yn fanwl gywir yma. Ar gyfer pethau - fel siopa bwyd, mae’n debygol o fod yn ddigon i edrych ar faint fyddwch yn - ei wario dros nifer o wythnosau a chyfrifo’r cyfartaledd. Ond ar gyfer pethau - fel gwisg ysgol a chostau untro eraill, bydd angen i chi edrych ar faint ydych - chi’n ei wario dros flwyddyn a rhannu gyda 12 i gael swm misol cyfartalog.
      • \n
      • \nTaliadau - yswiriant a benthyciadau. Chwiliwch am unrhyw beth fyddwch yn ei - dalu’n rheolaidd fel yswiriant cartref, taliadau catalog a thaliadau cardiau - credyd a gwneud nodyn ohonynt.
      • \n
      • \nPlant ac anifeiliaid - anwes. Mae hyn yn cynnwys pethau fel gofal plant, clybiau ar ôl ysgol, - a theithiau ysgol. Bydd rhai o’r costau hyn yn rheolaidd ac eraill yn achlysurol, - felly bydd angen cyfrifo’r cyfartaledd. Os oes gennych anifeiliaid anwes, - cyfrifwch bopeth y byddwch yn ei wario ar eu bwyd, biliau milfeddyg ac ati.
      • \n
      • \nTeithio. - Os oes gennych gar, sicrhewch eich bod yn cynnwys y costau i gyd (gan gynnwys - rhai fel treth car – a elwir yn dreth ffordd hefyd – y byddwch yn eu ","published_at":"2017-10-11T10:38:22.000Z","objectID":"/cy/articles/sut-i-gyllidebu-ar-gyfer-taliad-budd-daliadau-misol","_highlightResult":{"title":{"value":"Sut - i gyllidebu ar gyfer taliad budd-daliadau - misol","matchLevel":"full","fullyHighlighted":true,"matchedWords":["sut","i","gyllidebu","ar","gyfer","taliad","budd","daliadau","misol"]},"description":{"value":"Mae - taliad Credyd Cyffredinol misol sengl yn golygu y bydd angen - ichi fynd i’r afael â chyllideb eich cartref - dyma sut i’w - wneud","matchLevel":"partial","fullyHighlighted":false,"matchedWords":["sut","i","taliad","misol"]}}}],"nbHits":1,"page":0,"nbPages":1,"hitsPerPage":10,"processingTimeMS":1,"exhaustiveNbHits":true,"query":"Sut - i gyllidebu ar gyfer taliad budd-daliadau misol","params":"highlightPreTag=%3Cb%3E&highlightPostTag=%3C%2Fb%3E&page=0&hitsPerPage=10&query=Sut+i+gyllidebu+ar+gyfer+taliad+budd-daliadau+misol"} - -' - http_version: - recorded_at: Tue, 05 Feb 2019 11:21:46 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_hitsPerPage_10_query_Foobar.yml b/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_hitsPerPage_10_query_Foobar.yml deleted file mode 100644 index 7692b6c849..0000000000 --- a/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_hitsPerPage_10_query_Foobar.yml +++ /dev/null @@ -1,54 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://bhpslyij2l-dsn.algolia.net/1/indexes/pages/query - body: - encoding: UTF-8 - string: '{"params":"highlightPreTag=%3Cb%3E\u0026highlightPostTag=%3C%2Fb%3E\u0026page=\u0026hitsPerPage=10\u0026query=Foobar"}' - headers: - User-Agent: - - Algolia for Ruby 1.19.1 - Accept: - - "*/*" - Accept-Encoding: - - gzip,deflate - Date: - - Wed, 28 Mar 2018 09:55:04 GMT - X-Algolia-Api-Key: - - "" - X-Algolia-Application-Id: - - "" - Content-Type: - - application/json; charset=utf-8 - response: - status: - code: 200 - message: OK - headers: - Server: - - nginx - Date: - - Wed, 28 Mar 2018 09:55:05 GMT - Content-Type: - - application/json; charset=UTF-8 - Content-Length: - - '220' - Connection: - - keep-alive - Access-Control-Allow-Origin: - - "*" - Cache-Control: - - no-cache - X-Content-Type-Options: - - nosniff - Content-Disposition: - - inline; filename=a.txt - body: - encoding: UTF-8 - string: '{"hits":[],"nbHits":0,"page":0,"nbPages":0,"hitsPerPage":10,"processingTimeMS":1,"exhaustiveNbHits":true,"query":"Foobar","params":"highlightPreTag=%3Cb%3E&highlightPostTag=%3C%2Fb%3E&page=&hitsPerPage=10&query=Foobar"} - -' - http_version: - recorded_at: Wed, 28 Mar 2018 09:55:05 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_hitsPerPage_10_query_How_to_budget_for_a_monthly_benefit_payment.yml b/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_hitsPerPage_10_query_How_to_budget_for_a_monthly_benefit_payment.yml deleted file mode 100644 index 22178e92a4..0000000000 --- a/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_hitsPerPage_10_query_How_to_budget_for_a_monthly_benefit_payment.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://bhpslyij2l-dsn.algolia.net/1/indexes/pages/query - body: - encoding: UTF-8 - string: '{"params":"highlightPreTag=%3Cb%3E\u0026highlightPostTag=%3C%2Fb%3E\u0026page=\u0026hitsPerPage=10\u0026query=How+to+budget+for+a+monthly+benefit+payment"}' - headers: - User-Agent: - - Algolia for Ruby 1.19.1 - Accept: - - "*/*" - Accept-Encoding: - - gzip,deflate - Date: - - Wed, 28 Mar 2018 09:55:07 GMT - X-Algolia-Api-Key: - - "" - X-Algolia-Application-Id: - - "" - Content-Type: - - application/json; charset=utf-8 - response: - status: - code: 200 - message: OK - headers: - Server: - - nginx - Date: - - Wed, 28 Mar 2018 09:55:07 GMT - Content-Type: - - application/json; charset=UTF-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Access-Control-Allow-Origin: - - "*" - Cache-Control: - - no-cache - X-Content-Type-Options: - - nosniff - Content-Disposition: - - inline; filename=a.txt - Content-Encoding: - - gzip - body: - encoding: UTF-8 - string: '{"hits":[{"title":"How to budget for a monthly benefit payment","description":"A - single monthly Universal Credit payment means you''ll need to get to grips - with your household budget - here''s how to do it","published_at":"2017-10-09T13:31:34.000Z","objectID":"/en/articles/how-to-budget-for-a-monthly-benefit-payment","_highlightResult":{"title":{"value":"How - to budget for a monthly benefit - payment","matchLevel":"full","fullyHighlighted":true,"matchedWords":["how","to","budget","for","a","monthly","benefit","payment"]},"description":{"value":"A - single monthly Universal Credit payment means you''ll need to - get to grips with your household budget - here''s how - to do it","matchLevel":"partial","fullyHighlighted":false,"matchedWords":["how","to","budget","a","monthly","payment"]},"published_at":{"value":"2017-10-09T13:31:34.000Z","matchLevel":"none","matchedWords":[]}}}],"nbHits":1,"page":0,"nbPages":1,"hitsPerPage":10,"processingTimeMS":1,"exhaustiveNbHits":true,"query":"How - to budget for a monthly benefit payment","params":"highlightPreTag=%3Cb%3E&highlightPostTag=%3C%2Fb%3E&page=&hitsPerPage=10&query=How+to+budget+for+a+monthly+benefit+payment"} - -' - http_version: - recorded_at: Wed, 28 Mar 2018 09:55:07 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_hitsPerPage_10_query_Sut_i_gyllidebu_ar_gyfer_taliad_budd-daliadau_misol.yml b/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_hitsPerPage_10_query_Sut_i_gyllidebu_ar_gyfer_taliad_budd-daliadau_misol.yml deleted file mode 100644 index aa2a22c035..0000000000 --- a/spec/cassettes/algolia/post/1/indexes/pages/query/highlightPreTag_3Cb_3E_highlightPostTag_3C_2Fb_3E_page_hitsPerPage_10_query_Sut_i_gyllidebu_ar_gyfer_taliad_budd-daliadau_misol.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://bhpslyij2l-dsn.algolia.net/1/indexes/pages/query - body: - encoding: UTF-8 - string: '{"params":"highlightPreTag=%3Cb%3E\u0026highlightPostTag=%3C%2Fb%3E\u0026page=\u0026hitsPerPage=10\u0026query=Sut+i+gyllidebu+ar+gyfer+taliad+budd-daliadau+misol"}' - headers: - User-Agent: - - Algolia for Ruby 1.19.1 - Accept: - - "*/*" - Accept-Encoding: - - gzip,deflate - Date: - - Wed, 28 Mar 2018 09:55:09 GMT - X-Algolia-Api-Key: - - "" - X-Algolia-Application-Id: - - "" - Content-Type: - - application/json; charset=utf-8 - response: - status: - code: 200 - message: OK - headers: - Server: - - nginx - Date: - - Wed, 28 Mar 2018 09:55:09 GMT - Content-Type: - - application/json; charset=UTF-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Access-Control-Allow-Origin: - - "*" - Cache-Control: - - no-cache - X-Content-Type-Options: - - nosniff - Content-Disposition: - - inline; filename=a.txt - Content-Encoding: - - gzip - body: - encoding: UTF-8 - string: '{"hits":[{"title":"Sut i gyllidebu ar gyfer taliad budd-daliadau misol","description":"Mae - taliad Credyd Cyffredinol misol sengl yn golygu y bydd angen ichi fynd i’r - afael â chyllideb eich cartref - dyma sut i’w wneud","published_at":"2017-10-11T10:38:22.000Z","objectID":"/cy/articles/sut-i-gyllidebu-ar-gyfer-taliad-budd-daliadau-misol","_highlightResult":{"title":{"value":"Sut - i gyllidebu ar gyfer taliad budd-daliadau - misol","matchLevel":"full","fullyHighlighted":true,"matchedWords":["sut","i","gyllidebu","ar","gyfer","taliad","budd","daliadau","misol"]},"description":{"value":"Mae - taliad Credyd Cyffredinol misol sengl yn golygu y bydd angen - ichi fynd i’r afael â chyllideb eich cartref - dyma sut i’w - wneud","matchLevel":"partial","fullyHighlighted":false,"matchedWords":["sut","i","taliad","misol"]},"published_at":{"value":"2017-10-11T10:38:22.000Z","matchLevel":"none","matchedWords":[]}}}],"nbHits":1,"page":0,"nbPages":1,"hitsPerPage":10,"processingTimeMS":1,"exhaustiveNbHits":true,"query":"Sut - i gyllidebu ar gyfer taliad budd-daliadau misol","params":"highlightPreTag=%3Cb%3E&highlightPostTag=%3C%2Fb%3E&page=&hitsPerPage=10&query=Sut+i+gyllidebu+ar+gyfer+taliad+budd-daliadau+misol"} - -' - http_version: - recorded_at: Wed, 28 Mar 2018 09:55:09 GMT -recorded_with: VCR 4.0.0 diff --git a/spec/controllers/search_results_controller_spec.rb b/spec/controllers/search_results_controller_spec.rb deleted file mode 100644 index a93aca05cc..0000000000 --- a/spec/controllers/search_results_controller_spec.rb +++ /dev/null @@ -1,52 +0,0 @@ -RSpec.describe SearchResultsController, type: :controller do - describe 'GET index' do - let(:query) { 'query' } - let(:search_results_collection) { double(any?: true) } - - context 'with a search term' do - before do - expect_any_instance_of(SiteSearch::Query).to receive(:results) - .and_return(search_results_collection) - end - - context 'that returns results' do - it 'assigns the result of the search reader to @search_results' do - get :index, locale: I18n.locale, query: query - - expect(assigns(:search_results)).to eq(search_results_collection) - end - - it 'renders the right template' do - get :index, locale: I18n.locale, query: query - - expect(response).to render_template 'search_results/index_with_results' - end - end - - context 'that returns no results' do - before { allow(search_results_collection).to receive(:any?) { false } } - - it 'renders the right template' do - get :index, locale: I18n.locale, query: query - - expect(response).to render_template 'search_results/index_no_results' - end - end - end - - context 'without a search term' do - it 'does not search' do - expect_any_instance_of(SiteSearch::Query).to_not receive(:results) - .and_return(search_results_collection) - - get :index, locale: I18n.locale - end - - it 'renders the default template' do - get :index, locale: I18n.locale - - expect(response).to render_template :index - end - end - end -end diff --git a/spec/decorators/search_result_collection_decorator_spec.rb b/spec/decorators/search_result_collection_decorator_spec.rb deleted file mode 100644 index f382ac439c..0000000000 --- a/spec/decorators/search_result_collection_decorator_spec.rb +++ /dev/null @@ -1,135 +0,0 @@ -RSpec.describe SearchResultCollectionDecorator do - include Draper::ViewHelpers - subject(:decorator) { described_class.decorate(result_collection) } - - let(:result) do - { - title: 'Budget planner', - description: 'You can use this planner.', - link: '/en/tools/budget-planner' - } - end - - let(:result_collection) do - SiteSearch::Results.new( - results: [result], - total_results: total_results, - page: page, - number_of_pages: number_of_pages, - per_page: per_page, - query: query - ) - end - let(:total_results) { 1 } - let(:page) { 1 } - let(:number_of_pages) { 1 } - let(:per_page) { 10 } - let(:query) { 'budget planner' } - - it "decorates the collection's items with SearchResultDecorator" do - expect(subject.first).to be_a SearchResultDecorator - end - - describe '#page' do - let(:page) { 1 } - - it 'added one more to the page number' do - expect(subject.page).to be(1) - end - end - - context 'with 5 pages of 10 results' do - let(:per_page) { 10 } - let(:total_results) { 50 } - - describe '#first_page?' do - subject { decorator.first_page? } - - context 'when first page' do - let(:page) { 1 } - - it { is_expected.to be_truthy } - end - - context 'when third page' do - let(:page) { 2 } - - it { is_expected.to be_falsey } - end - - context 'when fifth page' do - let(:page) { 4 } - - it { is_expected.to be_falsey } - end - end - - describe '#last_page?' do - let(:number_of_pages) { 5 } - subject { decorator.last_page? } - - context 'when first page' do - let(:page) { 1 } - - it { is_expected.to be_falsey } - end - - context 'when third page' do - let(:page) { 3 } - - it { is_expected.to be_falsey } - end - - context 'when fifth page' do - let(:page) { 5 } - - it { is_expected.to be_truthy } - end - end - - describe '#previous_page' do - subject { decorator.previous_page } - - context 'when first page' do - let(:page) { 1 } - - it { is_expected.to be_nil } - end - - context 'when third page' do - let(:page) { 3 } - - it { is_expected.to eql 2 } - end - - context 'when fifth page' do - let(:page) { 5 } - - it { is_expected.to eql 4 } - end - end - - describe '#next_page' do - let(:number_of_pages) { 5 } - subject { decorator.next_page } - - context 'when first page' do - let(:page) { 1 } - - it { is_expected.to eql 2 } - end - - context 'when third page' do - let(:page) { 3 } - - it { is_expected.to eql 4 } - end - - context 'when fifth page' do - let(:page) { 5 } - - it { is_expected.to be_nil } - end - end - end -end diff --git a/spec/decorators/search_result_decorator_spec.rb b/spec/decorators/search_result_decorator_spec.rb deleted file mode 100644 index 2b8c956de7..0000000000 --- a/spec/decorators/search_result_decorator_spec.rb +++ /dev/null @@ -1,42 +0,0 @@ -RSpec.describe SearchResultDecorator do - include Draper::ViewHelpers - - subject(:decorator) { described_class.decorate(search_result) } - - let(:title) { double } - let(:description) { double } - let(:search_result) do - instance_double( - SiteSearch::Result, - link: 'item-id', title: title, description: description - ) - end - - it { is_expected.to respond_to(:link) } - it { is_expected.to respond_to(:description) } - it { is_expected.to respond_to(:title) } - - describe '#description' do - subject { decorator.description } - - context 'when description is present' do - let(:description) do - '

        If you created your budget plan

        ' - end - - before { allow(search_result).to receive(:description) { description } } - - it { is_expected.to eq('

        If you created your budget plan

        ') } - end - - context 'when description is blank' do - let(:description) {} - - before { allow(search_result).to receive(:description) { description } } - - it 'returns empty' do - expect(subject).to be_empty - end - end - end -end diff --git a/spec/fixtures/search-results/content-service.json b/spec/fixtures/search-results/content-service.json deleted file mode 100644 index 07751a83e2..0000000000 --- a/spec/fixtures/search-results/content-service.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "searchResults":[ - { - "url":"/content/action-plans/budget-planner", - "preview":{ - "title":"Budget planner", - "preview":"This is budget description" - }, - "exactMatch":false, - "id":"budget-planner", - "type":"action-plan" - }, - { - "url":"/content/category/divorce-and-separation", - "preview":{ - "title":"Divorce and Separation", - "description":"Divorce and Separation" - }, - "exactMatch":false, - "id":"divorce-and-separation", - "type":"category" - } - ] -} diff --git a/spec/lib/core/entity/search_result_collection_spec.rb b/spec/lib/core/entity/search_result_collection_spec.rb deleted file mode 100644 index 7ad76e8ca0..0000000000 --- a/spec/lib/core/entity/search_result_collection_spec.rb +++ /dev/null @@ -1,42 +0,0 @@ -module Core - RSpec.describe SearchResultCollection, type: :model do - let(:items) { [] } - let(:attributes) { { items: items } } - subject(:result_collection) { described_class.new(attributes) } - - it { is_expected.to have_attributes(:total_results, :page, :per_page, :spelling_suggestion, :corrected_query) } - it { is_expected.to have_read_only_attributes(:items, :query) } - - it 'is a collection' do - expect(subject.to_a).to be_kind_of(Array) - end - - describe '#spelling_suggestion?' do - subject { result_collection.spelling_suggestion? } - - context 'when it contains spelling_suggestion' do - let(:attributes) { { spelling_suggestion: double } } - - it { is_expected.to be_truthy } - end - - context 'when it does not contain spelling_suggestion' do - it { is_expected.to be_falsy } - end - end - - describe '#corrected_query?' do - subject { result_collection.corrected_query? } - - context 'when it contains corrected_query' do - before { result_collection.corrected_query = 'correction' } - - it { is_expected.to be_truthy } - end - - context 'when it does not contain corrected_query' do - it { is_expected.to be_falsy } - end - end - end -end diff --git a/spec/lib/core/entity/search_result_spec.rb b/spec/lib/core/entity/search_result_spec.rb deleted file mode 100644 index 792336151c..0000000000 --- a/spec/lib/core/entity/search_result_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Core - RSpec.describe SearchResult, type: :model do - subject { described_class.new(double, attributes) } - - let(:attributes) { { title: double } } - - it { is_expected.to have_attributes(:title) } - - it { is_expected.to validate_presence_of(:title) } - end -end diff --git a/spec/views/header_search_box_spec.rb b/spec/views/header_search_box_spec.rb deleted file mode 100644 index 59de1f3602..0000000000 --- a/spec/views/header_search_box_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -RSpec.describe 'shared/_header', type: :view do - before do - controller.extend(Localisation) - - allow(view).to receive(:user_signed_in?) { false } - allow(view).to receive(:display_search_box_in_header?) { display } - allow(view).to receive(:alternate_locales) { [] } - allow(view).to receive(:hide_elements_irrelevant_for_third_parties?) { false } - allow(view).to receive(:show_home_banner?) { false } - end - - context 'when the search box should be displayed in the header' do - let(:display) { true } - - it 'is displayed' do - render - - expect(rendered).to include('search') - end - end - - context 'when the search box should NOT be displayed in the header' do - let(:display) { false } - - it 'is NOT displayed' do - render - - expect(rendered).to_not include('search') - end - end -end