From 9485f6d463be251de36d41385f943fc8a2f93a09 Mon Sep 17 00:00:00 2001 From: Christine-horrocks Date: Fri, 7 Dec 2018 13:22:46 +0000 Subject: [PATCH] WEBDEV-1056_statutory-instruments/statutory-instrament/work-package --- Gemfile | 2 +- Gemfile.lock | 84 +++++----- .../work_packages_controller.rb | 22 +++ .../work_packages_controller.rb | 22 +++ .../work_package_list_components_factory.rb | 2 - config/locales/en.yml | 3 + .../work_packages_controller_spec.rb | 82 +++++++++ .../work_packages_controller_spec.rb | 82 +++++++++ .../index/fixture.yml | 158 ++++++++++++++++++ .../index/fixture.yml | 158 ++++++++++++++++++ ..._Heading1ComponentSerializer_correctly.yml | 53 ++++++ ...calls_the_ListPageSerializer_correctly.yml | 53 ++++++ .../renders_expected_JSON_output.yml | 53 ++++++ ...ve_a_response_with_http_status_ok_200_.yml | 53 ++++++ .../assigns_work_packaged_thing.yml | 53 ++++++ .../assigns_work_packages.yml | 53 ++++++ ..._Heading1ComponentSerializer_correctly.yml | 53 ++++++ ...calls_the_ListPageSerializer_correctly.yml | 53 ++++++ .../renders_expected_JSON_output.yml | 53 ++++++ ...ve_a_response_with_http_status_ok_200_.yml | 53 ++++++ .../assigns_work_packaged_thing.yml | 53 ++++++ .../assigns_work_packages.yml | 53 ++++++ .../work_packages_controller_spec.rb | 20 +++ .../work_packages_controller_spec.rb | 20 +++ 24 files changed, 1246 insertions(+), 45 deletions(-) create mode 100644 app/controllers/proposed_negative_statutory_instruments/work_packages_controller.rb create mode 100644 app/controllers/statutory_instruments/work_packages_controller.rb create mode 100644 spec/controllers/proposed_negative_statutory_instruments/work_packages_controller_spec.rb create mode 100644 spec/controllers/statutory_instruments/work_packages_controller_spec.rb create mode 100644 spec/fixtures/controllers/proposed_negative_statutory_instruments/work_packages_controller/index/fixture.yml create mode 100644 spec/fixtures/controllers/statutory_instruments/work_packages_controller/index/fixture.yml create mode 100644 spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_Heading1ComponentSerializer_correctly.yml create mode 100644 spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_ListPageSerializer_correctly.yml create mode 100644 spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/navigating_to_the_index_page/renders_expected_JSON_output.yml create mode 100644 spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/should_have_a_response_with_http_status_ok_200_.yml create mode 100644 spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packaged_thing.yml create mode 100644 spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packages.yml create mode 100644 spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_Heading1ComponentSerializer_correctly.yml create mode 100644 spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_ListPageSerializer_correctly.yml create mode 100644 spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/navigating_to_the_index_page/renders_expected_JSON_output.yml create mode 100644 spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/should_have_a_response_with_http_status_ok_200_.yml create mode 100644 spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packaged_thing.yml create mode 100644 spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packages.yml create mode 100644 spec/integration/controllers/proposed_negative_statutory_instruments/work_packages_controller_spec.rb create mode 100644 spec/integration/controllers/statutory_instruments/work_packages_controller_spec.rb diff --git a/Gemfile b/Gemfile index 01297d7a..bde13eb0 100644 --- a/Gemfile +++ b/Gemfile @@ -23,7 +23,7 @@ gem 'parliament-opensearch', '~> 0.4', require: false gem 'parliament-grom-decorators', '~> 1.0.2' # Parliament routing -gem 'parliament-routes', '~> 0.6' +gem 'parliament-routes', '~> 0.6.29' gem 'parliament-ntriple', '~> 0.3', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 3b5d69f1..ecb7d287 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,43 +1,43 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.2.1.1) - actionpack (= 5.2.1.1) + actioncable (5.2.2) + actionpack (= 5.2.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.1.1) - actionpack (= 5.2.1.1) - actionview (= 5.2.1.1) - activejob (= 5.2.1.1) + actionmailer (5.2.2) + actionpack (= 5.2.2) + actionview (= 5.2.2) + activejob (= 5.2.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.1.1) - actionview (= 5.2.1.1) - activesupport (= 5.2.1.1) + actionpack (5.2.2) + actionview (= 5.2.2) + activesupport (= 5.2.2) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.1.1) - activesupport (= 5.2.1.1) + actionview (5.2.2) + activesupport (= 5.2.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.1.1) - activesupport (= 5.2.1.1) + activejob (5.2.2) + activesupport (= 5.2.2) globalid (>= 0.3.6) - activemodel (5.2.1.1) - activesupport (= 5.2.1.1) - activerecord (5.2.1.1) - activemodel (= 5.2.1.1) - activesupport (= 5.2.1.1) + activemodel (5.2.2) + activesupport (= 5.2.2) + activerecord (5.2.2) + activemodel (= 5.2.2) + activesupport (= 5.2.2) arel (>= 9.0) - activestorage (5.2.1.1) - actionpack (= 5.2.1.1) - activerecord (= 5.2.1.1) + activestorage (5.2.2) + actionpack (= 5.2.2) + activerecord (= 5.2.2) marcel (~> 0.3.1) - activesupport (5.2.1.1) + activesupport (5.2.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -94,7 +94,7 @@ GEM hamster (3.0.0) concurrent-ruby (~> 1.0) hashdiff (0.3.7) - i18n (1.1.1) + i18n (1.2.0) concurrent-ruby (~> 1.0) jaro_winkler (1.5.1) json (2.1.0) @@ -129,7 +129,7 @@ GEM parliament-opensearch (0.7.0) activesupport (>= 5.0.0.1) feedjira (~> 2.1, >= 2.1.2) - parliament-routes (0.6.27) + parliament-routes (0.6.29) parliament-ruby (0.10.2) parser (2.5.3.0) ast (~> 2.4.0) @@ -141,20 +141,20 @@ GEM rack-test (1.1.0) rack (>= 1.0, < 3) rack-timeout (0.5.1) - rails (5.2.1.1) - actioncable (= 5.2.1.1) - actionmailer (= 5.2.1.1) - actionpack (= 5.2.1.1) - actionview (= 5.2.1.1) - activejob (= 5.2.1.1) - activemodel (= 5.2.1.1) - activerecord (= 5.2.1.1) - activestorage (= 5.2.1.1) - activesupport (= 5.2.1.1) + rails (5.2.2) + actioncable (= 5.2.2) + actionmailer (= 5.2.2) + actionpack (= 5.2.2) + actionview (= 5.2.2) + activejob (= 5.2.2) + activemodel (= 5.2.2) + activerecord (= 5.2.2) + activestorage (= 5.2.2) + activesupport (= 5.2.2) bundler (>= 1.3.0) - railties (= 5.2.1.1) + railties (= 5.2.2) sprockets-rails (>= 2.0.0) - rails-controller-testing (1.0.3) + rails-controller-testing (1.0.4) actionpack (>= 5.0.1.x) actionview (>= 5.0.1.x) activesupport (>= 5.0.1.x) @@ -163,14 +163,14 @@ GEM nokogiri (>= 1.6) rails-html-sanitizer (1.0.4) loofah (~> 2.2, >= 2.2.2) - railties (5.2.1.1) - actionpack (= 5.2.1.1) - activesupport (= 5.2.1.1) + railties (5.2.2) + actionpack (= 5.2.2) + activesupport (= 5.2.2) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) rainbow (3.0.0) - rake (12.3.1) + rake (12.3.2) rb-fsevent (0.10.3) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) @@ -197,7 +197,7 @@ GEM rspec-mocks (~> 3.8.0) rspec-support (~> 3.8.0) rspec-support (3.8.0) - rubocop (0.60.0) + rubocop (0.61.1) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) @@ -266,7 +266,7 @@ DEPENDENCIES parliament-grom-decorators (~> 1.0.2) parliament-ntriple (~> 0.3) parliament-opensearch (~> 0.4) - parliament-routes (~> 0.6) + parliament-routes (~> 0.6.29) parliament-ruby (~> 0.8) puma (~> 3.11) rack-rewrite diff --git a/app/controllers/proposed_negative_statutory_instruments/work_packages_controller.rb b/app/controllers/proposed_negative_statutory_instruments/work_packages_controller.rb new file mode 100644 index 00000000..e5476f21 --- /dev/null +++ b/app/controllers/proposed_negative_statutory_instruments/work_packages_controller.rb @@ -0,0 +1,22 @@ +module ProposedNegativeStatutoryInstruments + class WorkPackagesController < ApplicationController + before_action :build_request, :data_check + + ROUTE_MAP = { + index: proc { |params| ParliamentHelper.parliament_request.proposed_negative_statutory_instrument_work_packages.set_url_params({ proposed_negative_statutory_instrument_id: params[:proposed_negative_statutory_instrument_id] }) } + }.freeze + + def index + @work_packaged_thing, @work_packages = FilterHelper.filter(@api_request, 'WorkPackagedThing', 'WorkPackage') + @work_packaged_thing = @work_packaged_thing.first + + list_components = WorkPackageListComponentsFactory.sort_and_build_components(work_packages: @work_packages, date_type: :laying_date) + + heading = ComponentSerializer::Heading1ComponentSerializer.new(heading: I18n.t('statutory_instruments.work_packages.index.title', statutory_instrument: @work_packaged_thing.try(:workPackagedThingName)), subheading: @work_packaged_thing.try(:workPackagedThingName), subheading_link: proposed_negative_statutory_instrument_path) + + serializer = PageSerializer::ListPageSerializer.new(request: request, heading_component: heading, list_components: list_components, data_alternates: @alternates) + + render_page(serializer) + end + end +end diff --git a/app/controllers/statutory_instruments/work_packages_controller.rb b/app/controllers/statutory_instruments/work_packages_controller.rb new file mode 100644 index 00000000..936924d3 --- /dev/null +++ b/app/controllers/statutory_instruments/work_packages_controller.rb @@ -0,0 +1,22 @@ +module StatutoryInstruments + class WorkPackagesController < ApplicationController + before_action :build_request, :data_check + + ROUTE_MAP = { + index: proc { |params| ParliamentHelper.parliament_request.statutory_instrument_work_packages.set_url_params({ statutory_instrument_id: params[:statutory_instrument_id] }) } + }.freeze + + def index + @work_packaged_thing, @work_packages = FilterHelper.filter(@api_request, 'WorkPackagedThing', 'WorkPackage') + @work_packaged_thing = @work_packaged_thing.first + + list_components = WorkPackageListComponentsFactory.sort_and_build_components(work_packages: @work_packages, date_type: :laying_date) + + heading = ComponentSerializer::Heading1ComponentSerializer.new(heading: I18n.t('statutory_instruments.work_packages.index.title', statutory_instrument: @work_packaged_thing.try(:workPackagedThingName)), subheading: @work_packaged_thing.try(:workPackagedThingName), subheading_link: statutory_instrument_path) + + serializer = PageSerializer::ListPageSerializer.new(request: request, heading_component: heading, list_components: list_components, data_alternates: @alternates) + + render_page(serializer) + end + end +end diff --git a/app/factories/work_package_list_components_factory.rb b/app/factories/work_package_list_components_factory.rb index ab9e1d52..96909ede 100644 --- a/app/factories/work_package_list_components_factory.rb +++ b/app/factories/work_package_list_components_factory.rb @@ -73,8 +73,6 @@ def date_description_list_item(work_package, date_type, grouping_block) 'laid-thing.laid-date' when DateType::BUSINESS_ITEM_DATE 'procedure-steps.subsidiary-resources.actualised-date' - else - nil end create_date_description_list_item(translation_string, date) if date && translation_string diff --git a/config/locales/en.yml b/config/locales/en.yml index 855f4522..39fadf9e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -71,6 +71,9 @@ en: type: "Statutory instrument" index: title: "Statutory instruments" + work_packages: + index: + title: "%{statutory_instrument} - procedural activity" proposed_negative_statutory_instruments: type: "Proposed negative statutory instrument" index: diff --git a/spec/controllers/proposed_negative_statutory_instruments/work_packages_controller_spec.rb b/spec/controllers/proposed_negative_statutory_instruments/work_packages_controller_spec.rb new file mode 100644 index 00000000..13e13fb0 --- /dev/null +++ b/spec/controllers/proposed_negative_statutory_instruments/work_packages_controller_spec.rb @@ -0,0 +1,82 @@ +require 'rails_helper' + +RSpec.describe ProposedNegativeStatutoryInstruments::WorkPackagesController, vcr: true do + describe 'GET index' do + let(:data_alternates) do + [{ + href: "#{ENV['PARLIAMENT_BASE_URL']}/proposed_negative_statutory_instrument_work_packages.nt?proposed_negative_statutory_instrument_id=XQq1bJo0", + type: 'application/n-triples' + }, + {href: "#{ENV['PARLIAMENT_BASE_URL']}/proposed_negative_statutory_instrument_work_packages.ttl?proposed_negative_statutory_instrument_id=XQq1bJo0", + type: 'text/turtle'}, + {href: "#{ENV['PARLIAMENT_BASE_URL']}/proposed_negative_statutory_instrument_work_packages.tsv?proposed_negative_statutory_instrument_id=XQq1bJo0", + type: 'text/tab-separated-values'}, + {href: "#{ENV['PARLIAMENT_BASE_URL']}/proposed_negative_statutory_instrument_work_packages.csv?proposed_negative_statutory_instrument_id=XQq1bJo0", + type: 'text/csv'}, + {href: "#{ENV['PARLIAMENT_BASE_URL']}/proposed_negative_statutory_instrument_work_packages.rj?proposed_negative_statutory_instrument_id=XQq1bJo0", + type: 'application/json+rdf'}, + {href: "#{ENV['PARLIAMENT_BASE_URL']}/proposed_negative_statutory_instrument_work_packages.json?proposed_negative_statutory_instrument_id=XQq1bJo0", + type: 'application/json+ld'}, + {href: "#{ENV['PARLIAMENT_BASE_URL']}/proposed_negative_statutory_instrument_work_packages.xml?proposed_negative_statutory_instrument_id=XQq1bJo0", + type: 'application/rdf+xml'}] + end + + let(:heading) {'a heading component'} + + before(:each) do + allow(PageSerializer::ListPageSerializer).to receive(:new) + allow(ComponentSerializer::Heading1ComponentSerializer).to receive(:new) {heading} + + allow(controller.request).to receive(:env).and_return({'ApplicationInsights.request.id' => '|1234abcd.'}) + + get :index, params: {proposed_negative_statutory_instrument_id: 'XQq1bJo0'} + end + + it 'should have a response with http status ok (200)' do + expect(response).to have_http_status(:ok) + end + + context 'the correct instance variables' do + it 'assigns @work_packaged_thing' do + expect(assigns(:work_packaged_thing)).to be_a(Grom::Node) + expect(assigns(:work_packaged_thing).type).to include('https://id.parliament.uk/schema/WorkPackagedThing') + end + + it 'assigns @work_packages' do + assigns(:work_packages).each do |work_package| + expect(work_package).to be_a(Grom::Node) + expect(work_package.type).to include('https://id.parliament.uk/schema/WorkPackage') + end + end + end + + context 'calling the serializers correctly' do + it 'calls the Heading1ComponentSerializer correctly' do + expect(ComponentSerializer::Heading1ComponentSerializer).to have_received(:new).with(heading: 'workPackagedThingName - 1 - procedural activity', subheading: 'workPackagedThingName - 1', subheading_link: '/proposed-negative-statutory-instruments/XQq1bJo0') + end + + it 'calls the ListPageSerializer correctly' do + list_components = [{"data" => + {"heading" => + {"data" => + {"content" => "workPackagedThingName - 1", + "size" => 2}, + "name" => "heading"}, + "list-description" => + {"data" => + {"items" => + [{"description"=>[{"content"=>"procedureName - 1"}], + "term"=>{"content"=>"laid-thing.procedure"}}, + {"description" => [{"content" => "shared.time-html", + "data"=>{"date"=>"5 December 2018", "datetime-value"=>"2018-12-05"}}], + "term" => + {"content" => + "laid-thing.laid-date"}}]}, + "name" => "list__description"}}, + "name" => "card__generic"}] + + expect(PageSerializer::ListPageSerializer).to have_received(:new).with(request: request, heading_component: heading, list_components: list_components, data_alternates: data_alternates) + end + end + end +end diff --git a/spec/controllers/statutory_instruments/work_packages_controller_spec.rb b/spec/controllers/statutory_instruments/work_packages_controller_spec.rb new file mode 100644 index 00000000..4b4681c3 --- /dev/null +++ b/spec/controllers/statutory_instruments/work_packages_controller_spec.rb @@ -0,0 +1,82 @@ +require 'rails_helper' + +RSpec.describe StatutoryInstruments::WorkPackagesController, vcr: true do + describe 'GET index' do + let(:data_alternates) do + [{ + href: "#{ENV['PARLIAMENT_BASE_URL']}/statutory_instrument_work_packages.nt?statutory_instrument_id=8JaRgUlk", + type: 'application/n-triples' + }, + {href: "#{ENV['PARLIAMENT_BASE_URL']}/statutory_instrument_work_packages.ttl?statutory_instrument_id=8JaRgUlk", + type: 'text/turtle'}, + {href: "#{ENV['PARLIAMENT_BASE_URL']}/statutory_instrument_work_packages.tsv?statutory_instrument_id=8JaRgUlk", + type: 'text/tab-separated-values'}, + {href: "#{ENV['PARLIAMENT_BASE_URL']}/statutory_instrument_work_packages.csv?statutory_instrument_id=8JaRgUlk", + type: 'text/csv'}, + {href: "#{ENV['PARLIAMENT_BASE_URL']}/statutory_instrument_work_packages.rj?statutory_instrument_id=8JaRgUlk", + type: 'application/json+rdf'}, + {href: "#{ENV['PARLIAMENT_BASE_URL']}/statutory_instrument_work_packages.json?statutory_instrument_id=8JaRgUlk", + type: 'application/json+ld'}, + {href: "#{ENV['PARLIAMENT_BASE_URL']}/statutory_instrument_work_packages.xml?statutory_instrument_id=8JaRgUlk", + type: 'application/rdf+xml'}] + end + + let(:heading) {'a heading component'} + + before(:each) do + allow(PageSerializer::ListPageSerializer).to receive(:new) + allow(ComponentSerializer::Heading1ComponentSerializer).to receive(:new) {heading} + + allow(controller.request).to receive(:env).and_return({'ApplicationInsights.request.id' => '|1234abcd.'}) + + get :index, params: {statutory_instrument_id: '8JaRgUlk'} + end + + it 'should have a response with http status ok (200)' do + expect(response).to have_http_status(:ok) + end + + context 'the correct instance variables' do + it 'assigns @work_packaged_thing' do + expect(assigns(:work_packaged_thing)).to be_a(Grom::Node) + expect(assigns(:work_packaged_thing).type).to include('https://id.parliament.uk/schema/WorkPackagedThing') + end + + it 'assigns @work_packages' do + assigns(:work_packages).each do |work_package| + expect(work_package).to be_a(Grom::Node) + expect(work_package.type).to include('https://id.parliament.uk/schema/WorkPackage') + end + end + end + + context 'calling the serializers correctly' do + it 'calls the Heading1ComponentSerializer correctly' do + expect(ComponentSerializer::Heading1ComponentSerializer).to have_received(:new).with(heading: 'workPackagedThingName - 1 - procedural activity', subheading: 'workPackagedThingName - 1', subheading_link: '/statutory-instruments/8JaRgUlk') + end + + it 'calls the ListPageSerializer correctly' do + list_components = [{"data" => + {"heading" => + {"data" => + {"content" => "workPackagedThingName - 1", + "size" => 2}, + "name" => "heading"}, + "list-description" => + {"data" => + {"items" => + [{"description"=>[{"content"=>"procedureName - 1"}], + "term"=>{"content"=>"laid-thing.procedure"}}, + {"description" => [{"content" => "shared.time-html", + "data"=>{"date"=>"3 December 2018", "datetime-value"=>"2018-12-03"}}], + "term" => + {"content" => + "laid-thing.laid-date"}}]}, + "name" => "list__description"}}, + "name" => "card__generic"}] + + expect(PageSerializer::ListPageSerializer).to have_received(:new).with(request: request, heading_component: heading, list_components: list_components, data_alternates: data_alternates) + end + end + end +end diff --git a/spec/fixtures/controllers/proposed_negative_statutory_instruments/work_packages_controller/index/fixture.yml b/spec/fixtures/controllers/proposed_negative_statutory_instruments/work_packages_controller/index/fixture.yml new file mode 100644 index 00000000..dbf12113 --- /dev/null +++ b/spec/fixtures/controllers/proposed_negative_statutory_instruments/work_packages_controller/index/fixture.yml @@ -0,0 +1,158 @@ +--- +layout: + template: layout +meta: + title: workPackagedThingName - 1 - procedural activity - UK Parliament + request-id: 123456 + data-alternates: + - type: application/n-triples + href: http://localhost:3030/proposed_negative_statutory_instrument_work_packages.nt?proposed_negative_statutory_instrument_id=XQq1bJo0 + - type: text/turtle + href: http://localhost:3030/proposed_negative_statutory_instrument_work_packages.ttl?proposed_negative_statutory_instrument_id=XQq1bJo0 + - type: text/tab-separated-values + href: http://localhost:3030/proposed_negative_statutory_instrument_work_packages.tsv?proposed_negative_statutory_instrument_id=XQq1bJo0 + - type: text/csv + href: http://localhost:3030/proposed_negative_statutory_instrument_work_packages.csv?proposed_negative_statutory_instrument_id=XQq1bJo0 + - type: application/json+rdf + href: http://localhost:3030/proposed_negative_statutory_instrument_work_packages.rj?proposed_negative_statutory_instrument_id=XQq1bJo0 + - type: application/json+ld + href: http://localhost:3030/proposed_negative_statutory_instrument_work_packages.json?proposed_negative_statutory_instrument_id=XQq1bJo0 + - type: application/rdf+xml + href: http://localhost:3030/proposed_negative_statutory_instrument_work_packages.xml?proposed_negative_statutory_instrument_id=XQq1bJo0 + open-graph: + title: workPackagedThingName - 1 - procedural activity - UK Parliament + original-url: https://www.example.com/proposed-negative-statutory-instruments/XQq1bJo0/work-packages + image-url: https://static.parliament.uk/assets-public/opengraph-oblong.png + image-width: '1200' + image-height: '630' + twitter-card: summary_large_image + opensearch-description-url: https://www.example.com/search/opensearch +header-components: +- name: link + data: + link: "#content" + display: + name: partials__display + data: + - component: skip-to-content + selector: skiplink + content: shared.header.skip-to-content +- name: status__banner + data: + display: + name: partials__display + data: + - component: status + variant: banner + - component: theme + variant: caution + - component: cookie + selector: cookie + components: + - name: paragraph + data: + - content: shared.header.cookie-banner-text + data: + link: "/meta/cookie-policy" +- name: status__banner + data: + display: + name: partials__display + data: + - component: status + variant: banner + components: + - name: paragraph + data: + - content: shared.header.beta-status +- name: header + data: + components: + - name: link + data: + link: "/" + display: + name: partials__display + data: + - component: uk_parliament + label: shared.header.label + components: + - name: icon__uk-parliament + data: shared.header.label + - name: form__search + data: + global: true + label: search.label + components: + - name: icon__search + data: search.search-icon + search-action: "/search" +main-components: +- name: section__primary + data: + content-flag: true + components: + - name: heading1 + data: + subheading: + content: workPackagedThingName + - 1 + heading: + content: workPackagedThingName - 1 - procedural activity +- name: section__section + data: + components: + - name: list__generic + data: + type: ol + display: + name: partials__display + data: + - component: list + variant: block + components: + - name: card__generic + data: + heading: + name: heading + data: + content: workPackagedThingName - + 1 + size: 2 + list-description: + name: list__description + data: + items: + - term: + content: laid-thing.procedure + description: + - content: procedureName - 1 + - term: + content: laid-thing.laid-date + description: + - content: shared.time-html + data: + date: 5 December 2018 + datetime-value: '2018-12-05' +footer-components: +- name: footer + data: + heading: + name: heading + data: + content: shared.meta.title + size: 2 + list-generic: + name: list__generic + data: + type: ul + display: + name: partials__display + data: + - component: list + contents: + - content: shared.footer.current-website + - content: shared.footer.cookie-policy + data: + link: "/meta/cookie-policy" + - content: shared.footer.data-protection-privacy diff --git a/spec/fixtures/controllers/statutory_instruments/work_packages_controller/index/fixture.yml b/spec/fixtures/controllers/statutory_instruments/work_packages_controller/index/fixture.yml new file mode 100644 index 00000000..7f75291e --- /dev/null +++ b/spec/fixtures/controllers/statutory_instruments/work_packages_controller/index/fixture.yml @@ -0,0 +1,158 @@ +--- +layout: + template: layout +meta: + title: workPackagedThingName - 1 - procedural activity - UK Parliament + request-id: 123456 + data-alternates: + - type: application/n-triples + href: http://localhost:3030/statutory_instrument_work_packages.nt?statutory_instrument_id=8JaRgUlk + - type: text/turtle + href: http://localhost:3030/statutory_instrument_work_packages.ttl?statutory_instrument_id=8JaRgUlk + - type: text/tab-separated-values + href: http://localhost:3030/statutory_instrument_work_packages.tsv?statutory_instrument_id=8JaRgUlk + - type: text/csv + href: http://localhost:3030/statutory_instrument_work_packages.csv?statutory_instrument_id=8JaRgUlk + - type: application/json+rdf + href: http://localhost:3030/statutory_instrument_work_packages.rj?statutory_instrument_id=8JaRgUlk + - type: application/json+ld + href: http://localhost:3030/statutory_instrument_work_packages.json?statutory_instrument_id=8JaRgUlk + - type: application/rdf+xml + href: http://localhost:3030/statutory_instrument_work_packages.xml?statutory_instrument_id=8JaRgUlk + open-graph: + title: workPackagedThingName - 1 - procedural activity - UK Parliament + original-url: https://www.example.com/statutory-instruments/8JaRgUlk/work-packages + image-url: https://static.parliament.uk/assets-public/opengraph-oblong.png + image-width: '1200' + image-height: '630' + twitter-card: summary_large_image + opensearch-description-url: https://www.example.com/search/opensearch +header-components: +- name: link + data: + link: "#content" + display: + name: partials__display + data: + - component: skip-to-content + selector: skiplink + content: shared.header.skip-to-content +- name: status__banner + data: + display: + name: partials__display + data: + - component: status + variant: banner + - component: theme + variant: caution + - component: cookie + selector: cookie + components: + - name: paragraph + data: + - content: shared.header.cookie-banner-text + data: + link: "/meta/cookie-policy" +- name: status__banner + data: + display: + name: partials__display + data: + - component: status + variant: banner + components: + - name: paragraph + data: + - content: shared.header.beta-status +- name: header + data: + components: + - name: link + data: + link: "/" + display: + name: partials__display + data: + - component: uk_parliament + label: shared.header.label + components: + - name: icon__uk-parliament + data: shared.header.label + - name: form__search + data: + global: true + label: search.label + components: + - name: icon__search + data: search.search-icon + search-action: "/search" +main-components: +- name: section__primary + data: + content-flag: true + components: + - name: heading1 + data: + subheading: + content: workPackagedThingName + - 1 + heading: + content: workPackagedThingName - 1 - procedural activity +- name: section__section + data: + components: + - name: list__generic + data: + type: ol + display: + name: partials__display + data: + - component: list + variant: block + components: + - name: card__generic + data: + heading: + name: heading + data: + content: workPackagedThingName - + 1 + size: 2 + list-description: + name: list__description + data: + items: + - term: + content: laid-thing.procedure + description: + - content: procedureName - 1 + - term: + content: laid-thing.laid-date + description: + - content: shared.time-html + data: + date: 3 December 2018 + datetime-value: '2018-12-03' +footer-components: +- name: footer + data: + heading: + name: heading + data: + content: shared.meta.title + size: 2 + list-generic: + name: list__generic + data: + type: ul + display: + name: partials__display + data: + - component: list + contents: + - content: shared.footer.current-website + - content: shared.footer.cookie-policy + data: + link: "/meta/cookie-policy" + - content: shared.footer.data-protection-privacy diff --git a/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_Heading1ComponentSerializer_correctly.yml b/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_Heading1ComponentSerializer_correctly.yml new file mode 100644 index 00000000..28112b9b --- /dev/null +++ b/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_Heading1ComponentSerializer_correctly.yml @@ -0,0 +1,53 @@ +--- +http_interactions: +- request: + method: get + uri: http://localhost:3030/proposed_negative_statutory_instrument_work_packages?proposed_negative_statutory_instrument_id=XQq1bJo0 + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + - application/n-triples + User-Agent: + - Ruby + Ocp-Apim-Subscription-Key: + - "" + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/n-triples + Content-Disposition: + - inline; filename="index" + Last-Modified: + - Fri, 07 Dec 2018 14:44:57 GMT + X-Content-Type-Options: + - nosniff + Content-Length: + - '1905' + body: + encoding: UTF-8 + string: | + . + "workPackagedThingName - 1" . + . + . + . + . + . + . + "procedureName - 1" . + . + "2018-12-05+00:00"^^ . + . + . + "2018-12-05+00:00"^^ . + http_version: + recorded_at: Fri, 07 Dec 2018 15:10:11 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_ListPageSerializer_correctly.yml b/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_ListPageSerializer_correctly.yml new file mode 100644 index 00000000..28112b9b --- /dev/null +++ b/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_ListPageSerializer_correctly.yml @@ -0,0 +1,53 @@ +--- +http_interactions: +- request: + method: get + uri: http://localhost:3030/proposed_negative_statutory_instrument_work_packages?proposed_negative_statutory_instrument_id=XQq1bJo0 + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + - application/n-triples + User-Agent: + - Ruby + Ocp-Apim-Subscription-Key: + - "" + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/n-triples + Content-Disposition: + - inline; filename="index" + Last-Modified: + - Fri, 07 Dec 2018 14:44:57 GMT + X-Content-Type-Options: + - nosniff + Content-Length: + - '1905' + body: + encoding: UTF-8 + string: | + . + "workPackagedThingName - 1" . + . + . + . + . + . + . + "procedureName - 1" . + . + "2018-12-05+00:00"^^ . + . + . + "2018-12-05+00:00"^^ . + http_version: + recorded_at: Fri, 07 Dec 2018 15:10:11 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/navigating_to_the_index_page/renders_expected_JSON_output.yml b/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/navigating_to_the_index_page/renders_expected_JSON_output.yml new file mode 100644 index 00000000..fe3772c2 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/navigating_to_the_index_page/renders_expected_JSON_output.yml @@ -0,0 +1,53 @@ +--- +http_interactions: +- request: + method: get + uri: http://localhost:3030/proposed_negative_statutory_instrument_work_packages?proposed_negative_statutory_instrument_id=XQq1bJo0 + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + - application/n-triples + User-Agent: + - Ruby + Ocp-Apim-Subscription-Key: + - "" + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/n-triples + Content-Disposition: + - inline; filename="index" + Last-Modified: + - Fri, 07 Dec 2018 14:44:57 GMT + X-Content-Type-Options: + - nosniff + Content-Length: + - '1905' + body: + encoding: UTF-8 + string: | + . + "workPackagedThingName - 1" . + . + . + . + . + . + . + "procedureName - 1" . + . + "2018-12-05+00:00"^^ . + . + . + "2018-12-05+00:00"^^ . + http_version: + recorded_at: Fri, 07 Dec 2018 15:24:31 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/should_have_a_response_with_http_status_ok_200_.yml b/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/should_have_a_response_with_http_status_ok_200_.yml new file mode 100644 index 00000000..28112b9b --- /dev/null +++ b/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/should_have_a_response_with_http_status_ok_200_.yml @@ -0,0 +1,53 @@ +--- +http_interactions: +- request: + method: get + uri: http://localhost:3030/proposed_negative_statutory_instrument_work_packages?proposed_negative_statutory_instrument_id=XQq1bJo0 + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + - application/n-triples + User-Agent: + - Ruby + Ocp-Apim-Subscription-Key: + - "" + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/n-triples + Content-Disposition: + - inline; filename="index" + Last-Modified: + - Fri, 07 Dec 2018 14:44:57 GMT + X-Content-Type-Options: + - nosniff + Content-Length: + - '1905' + body: + encoding: UTF-8 + string: | + . + "workPackagedThingName - 1" . + . + . + . + . + . + . + "procedureName - 1" . + . + "2018-12-05+00:00"^^ . + . + . + "2018-12-05+00:00"^^ . + http_version: + recorded_at: Fri, 07 Dec 2018 15:10:11 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packaged_thing.yml b/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packaged_thing.yml new file mode 100644 index 00000000..28112b9b --- /dev/null +++ b/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packaged_thing.yml @@ -0,0 +1,53 @@ +--- +http_interactions: +- request: + method: get + uri: http://localhost:3030/proposed_negative_statutory_instrument_work_packages?proposed_negative_statutory_instrument_id=XQq1bJo0 + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + - application/n-triples + User-Agent: + - Ruby + Ocp-Apim-Subscription-Key: + - "" + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/n-triples + Content-Disposition: + - inline; filename="index" + Last-Modified: + - Fri, 07 Dec 2018 14:44:57 GMT + X-Content-Type-Options: + - nosniff + Content-Length: + - '1905' + body: + encoding: UTF-8 + string: | + . + "workPackagedThingName - 1" . + . + . + . + . + . + . + "procedureName - 1" . + . + "2018-12-05+00:00"^^ . + . + . + "2018-12-05+00:00"^^ . + http_version: + recorded_at: Fri, 07 Dec 2018 15:10:11 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packages.yml b/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packages.yml new file mode 100644 index 00000000..28112b9b --- /dev/null +++ b/spec/fixtures/vcr_cassettes/ProposedNegativeStatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packages.yml @@ -0,0 +1,53 @@ +--- +http_interactions: +- request: + method: get + uri: http://localhost:3030/proposed_negative_statutory_instrument_work_packages?proposed_negative_statutory_instrument_id=XQq1bJo0 + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + - application/n-triples + User-Agent: + - Ruby + Ocp-Apim-Subscription-Key: + - "" + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/n-triples + Content-Disposition: + - inline; filename="index" + Last-Modified: + - Fri, 07 Dec 2018 14:44:57 GMT + X-Content-Type-Options: + - nosniff + Content-Length: + - '1905' + body: + encoding: UTF-8 + string: | + . + "workPackagedThingName - 1" . + . + . + . + . + . + . + "procedureName - 1" . + . + "2018-12-05+00:00"^^ . + . + . + "2018-12-05+00:00"^^ . + http_version: + recorded_at: Fri, 07 Dec 2018 15:10:11 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_Heading1ComponentSerializer_correctly.yml b/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_Heading1ComponentSerializer_correctly.yml new file mode 100644 index 00000000..7976c592 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_Heading1ComponentSerializer_correctly.yml @@ -0,0 +1,53 @@ +--- +http_interactions: +- request: + method: get + uri: http://localhost:3030/statutory_instrument_work_packages?statutory_instrument_id=8JaRgUlk + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + - application/n-triples + User-Agent: + - Ruby + Ocp-Apim-Subscription-Key: + - "" + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/n-triples + Content-Disposition: + - inline; filename="index" + Last-Modified: + - Fri, 07 Dec 2018 12:22:30 GMT + X-Content-Type-Options: + - nosniff + Content-Length: + - '1875' + body: + encoding: UTF-8 + string: | + . + "workPackagedThingName - 1" . + . + . + . + . + . + . + "procedureName - 1" . + . + "2018-12-03+00:00"^^ . + . + . + "2018-12-03+00:00"^^ . + http_version: + recorded_at: Fri, 07 Dec 2018 12:40:12 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_ListPageSerializer_correctly.yml b/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_ListPageSerializer_correctly.yml new file mode 100644 index 00000000..e0187ade --- /dev/null +++ b/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/calling_the_serializers_correctly/calls_the_ListPageSerializer_correctly.yml @@ -0,0 +1,53 @@ +--- +http_interactions: +- request: + method: get + uri: http://localhost:3030/statutory_instrument_work_packages?statutory_instrument_id=8JaRgUlk + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + - application/n-triples + User-Agent: + - Ruby + Ocp-Apim-Subscription-Key: + - "" + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/n-triples + Content-Disposition: + - inline; filename="index" + Last-Modified: + - Fri, 07 Dec 2018 12:22:30 GMT + X-Content-Type-Options: + - nosniff + Content-Length: + - '1875' + body: + encoding: UTF-8 + string: | + . + "workPackagedThingName - 1" . + . + . + . + . + . + . + "procedureName - 1" . + . + "2018-12-03+00:00"^^ . + . + . + "2018-12-03+00:00"^^ . + http_version: + recorded_at: Fri, 07 Dec 2018 12:58:31 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/navigating_to_the_index_page/renders_expected_JSON_output.yml b/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/navigating_to_the_index_page/renders_expected_JSON_output.yml new file mode 100644 index 00000000..b1fd1a33 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/navigating_to_the_index_page/renders_expected_JSON_output.yml @@ -0,0 +1,53 @@ +--- +http_interactions: +- request: + method: get + uri: http://localhost:3030/statutory_instrument_work_packages?statutory_instrument_id=8JaRgUlk + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + - application/n-triples + User-Agent: + - Ruby + Ocp-Apim-Subscription-Key: + - "" + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/n-triples + Content-Disposition: + - inline; filename="index" + Last-Modified: + - Fri, 07 Dec 2018 12:22:30 GMT + X-Content-Type-Options: + - nosniff + Content-Length: + - '1875' + body: + encoding: UTF-8 + string: | + . + "workPackagedThingName - 1" . + . + . + . + . + . + . + "procedureName - 1" . + . + "2018-12-03+00:00"^^ . + . + . + "2018-12-03+00:00"^^ . + http_version: + recorded_at: Fri, 07 Dec 2018 13:03:03 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/should_have_a_response_with_http_status_ok_200_.yml b/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/should_have_a_response_with_http_status_ok_200_.yml new file mode 100644 index 00000000..7976c592 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/should_have_a_response_with_http_status_ok_200_.yml @@ -0,0 +1,53 @@ +--- +http_interactions: +- request: + method: get + uri: http://localhost:3030/statutory_instrument_work_packages?statutory_instrument_id=8JaRgUlk + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + - application/n-triples + User-Agent: + - Ruby + Ocp-Apim-Subscription-Key: + - "" + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/n-triples + Content-Disposition: + - inline; filename="index" + Last-Modified: + - Fri, 07 Dec 2018 12:22:30 GMT + X-Content-Type-Options: + - nosniff + Content-Length: + - '1875' + body: + encoding: UTF-8 + string: | + . + "workPackagedThingName - 1" . + . + . + . + . + . + . + "procedureName - 1" . + . + "2018-12-03+00:00"^^ . + . + . + "2018-12-03+00:00"^^ . + http_version: + recorded_at: Fri, 07 Dec 2018 12:40:12 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packaged_thing.yml b/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packaged_thing.yml new file mode 100644 index 00000000..7976c592 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packaged_thing.yml @@ -0,0 +1,53 @@ +--- +http_interactions: +- request: + method: get + uri: http://localhost:3030/statutory_instrument_work_packages?statutory_instrument_id=8JaRgUlk + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + - application/n-triples + User-Agent: + - Ruby + Ocp-Apim-Subscription-Key: + - "" + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/n-triples + Content-Disposition: + - inline; filename="index" + Last-Modified: + - Fri, 07 Dec 2018 12:22:30 GMT + X-Content-Type-Options: + - nosniff + Content-Length: + - '1875' + body: + encoding: UTF-8 + string: | + . + "workPackagedThingName - 1" . + . + . + . + . + . + . + "procedureName - 1" . + . + "2018-12-03+00:00"^^ . + . + . + "2018-12-03+00:00"^^ . + http_version: + recorded_at: Fri, 07 Dec 2018 12:40:12 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packages.yml b/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packages.yml new file mode 100644 index 00000000..7976c592 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/StatutoryInstruments_WorkPackagesController/GET_index/the_correct_instance_variables/assigns_work_packages.yml @@ -0,0 +1,53 @@ +--- +http_interactions: +- request: + method: get + uri: http://localhost:3030/statutory_instrument_work_packages?statutory_instrument_id=8JaRgUlk + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + - application/n-triples + User-Agent: + - Ruby + Ocp-Apim-Subscription-Key: + - "" + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/n-triples + Content-Disposition: + - inline; filename="index" + Last-Modified: + - Fri, 07 Dec 2018 12:22:30 GMT + X-Content-Type-Options: + - nosniff + Content-Length: + - '1875' + body: + encoding: UTF-8 + string: | + . + "workPackagedThingName - 1" . + . + . + . + . + . + . + "procedureName - 1" . + . + "2018-12-03+00:00"^^ . + . + . + "2018-12-03+00:00"^^ . + http_version: + recorded_at: Fri, 07 Dec 2018 12:40:12 GMT +recorded_with: VCR 4.0.0 diff --git a/spec/integration/controllers/proposed_negative_statutory_instruments/work_packages_controller_spec.rb b/spec/integration/controllers/proposed_negative_statutory_instruments/work_packages_controller_spec.rb new file mode 100644 index 00000000..e5f694fe --- /dev/null +++ b/spec/integration/controllers/proposed_negative_statutory_instruments/work_packages_controller_spec.rb @@ -0,0 +1,20 @@ +require_relative '../../../rails_helper' + +RSpec.describe ProposedNegativeStatutoryInstruments::WorkPackagesController, vcr: true do + describe 'GET index' do + before(:each) do + allow_any_instance_of(PageSerializer::ListPageSerializer).to receive(:request_id) { 123456 } + end + + context 'navigating to the index page' do + it 'renders expected JSON output' do + get '/proposed-negative-statutory-instruments/XQq1bJo0/work-packages' + filtered_response_body = filter_sensitive_data(response.body) + + expected_json = get_fixture('index', 'fixture') + + expect(JSON.parse(filtered_response_body).to_yaml).to eq(expected_json) + end + end + end +end diff --git a/spec/integration/controllers/statutory_instruments/work_packages_controller_spec.rb b/spec/integration/controllers/statutory_instruments/work_packages_controller_spec.rb new file mode 100644 index 00000000..0de7d251 --- /dev/null +++ b/spec/integration/controllers/statutory_instruments/work_packages_controller_spec.rb @@ -0,0 +1,20 @@ +require_relative '../../../rails_helper' + +RSpec.describe StatutoryInstruments::WorkPackagesController, vcr: true do + describe 'GET index' do + before(:each) do + allow_any_instance_of(PageSerializer::ListPageSerializer).to receive(:request_id) { 123456 } + end + + context 'navigating to the index page' do + it 'renders expected JSON output' do + get '/statutory-instruments/8JaRgUlk/work-packages' + filtered_response_body = filter_sensitive_data(response.body) + + expected_json = get_fixture('index', 'fixture') + + expect(JSON.parse(filtered_response_body).to_yaml).to eq(expected_json) + end + end + end +end