Browse Source

Merge branch 'CLDC-4173-new-building-height-question-sales' into CLDC-4178-add-gender-same-as-sex-question-for-sales

pull/3188/head
Nat Dean-Lewis 3 weeks ago
parent
commit
80032b4bf7
  1. 3
      spec/fixtures/files/sales_logs_csv_export_non_support_codes_26.csv
  2. 3
      spec/fixtures/files/sales_logs_csv_export_non_support_labels_26.csv
  3. 38
      spec/services/csv/sales_log_csv_service_spec.rb

3
spec/fixtures/files/sales_logs_csv_export_non_support_codes_26.csv vendored

File diff suppressed because one or more lines are too long

3
spec/fixtures/files/sales_logs_csv_export_non_support_labels_26.csv vendored

File diff suppressed because one or more lines are too long

38
spec/services/csv/sales_log_csv_service_spec.rb

@ -468,5 +468,43 @@ RSpec.describe Csv::SalesLogCsvService do
end
end
end
context "and the requested form is 2026" do
let(:year) { 2026 }
let(:now) { Time.zone.local(2026, 5, 1) }
let(:fixed_time) { Time.zone.local(2026, 5, 1) }
before do
log.update!(nationality_all: 36, manual_address_entry_selected: false, uprn: "1", uprn_known: 1, buildheightclass: 2)
end
context "and exporting with labels" do
let(:service) { described_class.new(user:, export_type: "labels", year:) }
it "exports the CSV with all values correct" do
expected_content = CSV.read("spec/fixtures/files/sales_logs_csv_export_non_support_labels_26.csv")
values_to_delete = %w[id owning_organisation_id managing_organisation_id assigned_to_id updated_by_id]
values_to_delete.each do |attribute|
index = attribute_line.index(attribute)
content_line[index] = nil
end
expect(csv[1..]).to eq expected_content[1..] # Skip the first line as it contains the definitions
end
end
context "and exporting with codes" do
let(:service) { described_class.new(user:, export_type: "codes", year:) }
it "exports the CSV with all values correct" do
expected_content = CSV.read("spec/fixtures/files/sales_logs_csv_export_non_support_codes_26.csv")
values_to_delete = %w[id owning_organisation_id managing_organisation_id assigned_to_id updated_by_id]
values_to_delete.each do |attribute|
index = attribute_line.index(attribute)
content_line[index] = nil
end
expect(csv[1..]).to eq expected_content[1..] # Skip the first line as it contains the definitions
end
end
end
end
end

Loading…
Cancel
Save