Browse Source

Display correct location code

pull/2043/head
Kat 3 years ago
parent
commit
21f8c9a1e8
  1. 2
      app/helpers/locations_helper.rb
  2. 4
      spec/features/schemes_spec.rb
  3. 6
      spec/helpers/locations_helper_spec.rb
  4. 1
      spec/views/locations/show.html.erb_spec.rb

2
app/helpers/locations_helper.rb

@ -32,7 +32,7 @@ module LocationsHelper
{ name: "Number of units", value: location.units, attribute: "units" },
{ name: "Most common unit", value: location.type_of_unit, attribute: "type_of_unit" },
{ name: "Mobility standards", value: location.mobility_type, attribute: "mobility_standards" },
{ name: "Location code", value: formatted_local_authority_timeline(location, "code"), attribute: "location_code" },
{ name: "Location code", value: location.id, attribute: "id" },
{ name: "Availability", value: location_availability(location), attribute: "availability" },
]
end

4
spec/features/schemes_spec.rb

@ -817,7 +817,7 @@ RSpec.describe "Schemes scheme Features" do
expect(page).to have_content(deactivated_location.units)
expect(page).to have_content(deactivated_location.type_of_unit)
expect(page).to have_content(deactivated_location.mobility_type)
expect(page).to have_content(deactivated_location.location_code)
expect(page).to have_content(deactivated_location.id)
expect(page).to have_content("Active from 4 April 2022 to 3 June 2022 Deactivated on 4 June 2022")
expect(page).to have_content("Deactivated")
end
@ -856,7 +856,7 @@ RSpec.describe "Schemes scheme Features" do
expect(page).to have_content(location.units)
expect(page).to have_content(location.type_of_unit)
expect(page).to have_content(location.mobility_type)
expect(page).to have_content(location.location_code)
expect(page).to have_content(location.id)
expect(page).to have_content("Active from 4 April 2022")
expect(page).to have_content("Active")
end

6
spec/helpers/locations_helper_spec.rb

@ -146,7 +146,7 @@ RSpec.describe LocationsHelper do
{ attribute: "units", name: "Number of units", value: location.units },
{ attribute: "type_of_unit", name: "Most common unit", value: location.type_of_unit },
{ attribute: "mobility_standards", name: "Mobility standards", value: location.mobility_type },
{ attribute: "location_code", name: "Location code", value: location.location_code },
{ attribute: "id", name: "Location code", value: location.id },
{ attribute: "availability", name: "Availability", value: "Active from 1 April 2022" },
]
@ -168,7 +168,7 @@ RSpec.describe LocationsHelper do
{ attribute: "units", name: "Number of units", value: location.units },
{ attribute: "type_of_unit", name: "Most common unit", value: location.type_of_unit },
{ attribute: "mobility_standards", name: "Mobility standards", value: location.mobility_type },
{ attribute: "location_code", name: "Location code", value: "E07000030 (until 31 March 2023)\nE06000063 (1 April 2023 - present)" },
{ attribute: "id", name: "Location code", value: location.id },
{ attribute: "availability", name: "Availability", value: "Active from 1 April 2022" },
]
@ -191,7 +191,7 @@ RSpec.describe LocationsHelper do
{ attribute: "units", name: "Number of units", value: location.units },
{ attribute: "type_of_unit", name: "Most common unit", value: location.type_of_unit },
{ attribute: "mobility_standards", name: "Mobility standards", value: location.mobility_type },
{ attribute: "location_code", name: "Location code", value: "" },
{ attribute: "id", name: "Location code", value: location.id },
{ attribute: "availability", name: "Availability", value: "Active from 1 April 2022" },
]

1
spec/views/locations/show.html.erb_spec.rb

@ -29,6 +29,7 @@ RSpec.describe "locations/show.html.erb" do
let(:location) do
instance_double(
Location,
id: 5,
name: "some location",
postcode: "EC1N 2TD",
linked_local_authorities: [],

Loading…
Cancel
Save