|
|
|
@ -48,7 +48,7 @@ RSpec.describe LocationsHelper do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "display_location_attributes" do |
|
|
|
describe "display_location_attributes" do |
|
|
|
let(:location) { FactoryBot.build(:location, startdate: Time.zone.local(2022, 4, 1)) } |
|
|
|
let(:location) { FactoryBot.build(:location, created_at: Time.zone.local(2022, 3, 16), startdate: Time.zone.local(2022, 4, 1)) } |
|
|
|
|
|
|
|
|
|
|
|
it "returns correct display attributes" do |
|
|
|
it "returns correct display attributes" do |
|
|
|
attributes = [ |
|
|
|
attributes = [ |
|
|
|
@ -74,6 +74,13 @@ RSpec.describe LocationsHelper do |
|
|
|
|
|
|
|
|
|
|
|
expect(availability_attribute).to eq("Active from #{location.created_at.to_formatted_s(:govuk_date)}") |
|
|
|
expect(availability_attribute).to eq("Active from #{location.created_at.to_formatted_s(:govuk_date)}") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "displays current collection start date as availability date if created_at is later than collection start date" do |
|
|
|
|
|
|
|
location.update!(startdate: nil, created_at: Time.zone.local(2022, 4, 16)) |
|
|
|
|
|
|
|
availability_attribute = display_location_attributes(location).find { |x| x[:name] == "Availability" }[:value] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect(availability_attribute).to eq("Active from 1 April 2022") |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "with previous deactivations" do |
|
|
|
context "with previous deactivations" do |
|
|
|
|