Browse Source

CLDC-4176: Remove sexn from CSV export

pull/3201/head
samyou-softwire 3 weeks ago
parent
commit
661dc9bced
  1. 3
      spec/fixtures/files/sales_logs_csv_export_codes_23.csv
  2. 2
      spec/fixtures/files/sales_logs_csv_export_codes_24.csv
  3. 2
      spec/fixtures/files/sales_logs_csv_export_codes_25.csv
  4. 6
      spec/fixtures/files/sales_logs_csv_export_codes_26.csv
  5. 3
      spec/fixtures/files/sales_logs_csv_export_labels_23.csv
  6. 2
      spec/fixtures/files/sales_logs_csv_export_labels_24.csv
  7. 2
      spec/fixtures/files/sales_logs_csv_export_labels_25.csv
  8. 6
      spec/fixtures/files/sales_logs_csv_export_labels_26.csv
  9. 6
      spec/fixtures/files/sales_logs_csv_export_non_support_codes_26.csv
  10. 2
      spec/fixtures/files/sales_logs_csv_export_non_support_labels_24.csv
  11. 2
      spec/fixtures/files/sales_logs_csv_export_non_support_labels_25.csv
  12. 6
      spec/fixtures/files/sales_logs_csv_export_non_support_labels_26.csv
  13. 94
      spec/services/csv/sales_log_csv_service_spec.rb

3
spec/fixtures/files/sales_logs_csv_export_codes_23.csv vendored

File diff suppressed because one or more lines are too long

2
spec/fixtures/files/sales_logs_csv_export_codes_24.csv vendored

File diff suppressed because one or more lines are too long

2
spec/fixtures/files/sales_logs_csv_export_codes_25.csv vendored

File diff suppressed because one or more lines are too long

6
spec/fixtures/files/sales_logs_csv_export_codes_26.csv vendored

File diff suppressed because one or more lines are too long

3
spec/fixtures/files/sales_logs_csv_export_labels_23.csv vendored

File diff suppressed because one or more lines are too long

2
spec/fixtures/files/sales_logs_csv_export_labels_24.csv vendored

File diff suppressed because one or more lines are too long

2
spec/fixtures/files/sales_logs_csv_export_labels_25.csv vendored

File diff suppressed because one or more lines are too long

6
spec/fixtures/files/sales_logs_csv_export_labels_26.csv vendored

File diff suppressed because one or more lines are too long

6
spec/fixtures/files/sales_logs_csv_export_non_support_codes_26.csv vendored

File diff suppressed because one or more lines are too long

2
spec/fixtures/files/sales_logs_csv_export_non_support_labels_24.csv vendored

File diff suppressed because one or more lines are too long

2
spec/fixtures/files/sales_logs_csv_export_non_support_labels_25.csv vendored

File diff suppressed because one or more lines are too long

6
spec/fixtures/files/sales_logs_csv_export_non_support_labels_26.csv vendored

File diff suppressed because one or more lines are too long

94
spec/services/csv/sales_log_csv_service_spec.rb

@ -1,6 +1,8 @@
require "rails_helper" require "rails_helper"
RSpec.describe Csv::SalesLogCsvService do RSpec.describe Csv::SalesLogCsvService do
include CollectionTimeHelper
subject(:task) { Rake::Task["data_import:add_variable_definitions"] } subject(:task) { Rake::Task["data_import:add_variable_definitions"] }
let(:form_handler_mock) { instance_double(FormHandler) } let(:form_handler_mock) { instance_double(FormHandler) }
@ -197,25 +199,10 @@ RSpec.describe Csv::SalesLogCsvService do
expect(la_label_value).to eq "Westminster" expect(la_label_value).to eq "Westminster"
end end
context "when the requested form is 2023" do context "when the requested form is 2024", metadata: { year: 24 } do
let(:now) { Time.zone.local(2024, 1, 1) } let(:now) { collection_start_date_for_year(2024) }
let(:year) { 2023 }
it "exports the CSV with the 2023 ordering and all values correct" do
expected_content = CSV.read("spec/fixtures/files/sales_logs_csv_export_labels_23.csv")
values_to_delete = %w[ID]
values_to_delete.each do |attribute|
index = attribute_line.index(attribute)
content_line[index] = nil
end
expect(csv).to eq expected_content
end
end
context "when the requested form is 2024" do
let(:now) { Time.zone.local(2024, 5, 1) }
let(:year) { 2024 } let(:year) { 2024 }
let(:fixed_time) { Time.zone.local(2024, 5, 1) } let(:fixed_time) { collection_start_date_for_year(2024) }
before do before do
log.update!(nationality_all: 36, manual_address_entry_selected: false, uprn: "1", uprn_known: 1) log.update!(nationality_all: 36, manual_address_entry_selected: false, uprn: "1", uprn_known: 1)
@ -232,10 +219,10 @@ RSpec.describe Csv::SalesLogCsvService do
end end
end end
context "when the requested form is 2025" do context "when the requested form is 2025", metadata: { year: 25 } do
let(:now) { Time.zone.local(2025, 5, 1) } let(:now) { collection_start_date_for_year(2025) }
let(:year) { 2025 } let(:year) { 2025 }
let(:fixed_time) { Time.zone.local(2025, 5, 1) } let(:fixed_time) { collection_start_date_for_year(2025) }
before do before do
log.update!(nationality_all: 36, manual_address_entry_selected: false, uprn: "1", uprn_known: 1) log.update!(nationality_all: 36, manual_address_entry_selected: false, uprn: "1", uprn_known: 1)
@ -252,13 +239,13 @@ RSpec.describe Csv::SalesLogCsvService do
end end
end end
context "when the requested form is 2026" do context "when the requested form is 2026", metadata: { year: 26 } do
let(:now) { Time.zone.local(2026, 5, 1) } let(:now) { collection_start_date_for_year(2026) }
let(:year) { 2026 } let(:year) { 2026 }
let(:fixed_time) { Time.zone.local(2026, 5, 1) } let(:fixed_time) { collection_start_date_for_year(2026) }
before do before do
log.update!(nationality_all: 36, manual_address_entry_selected: false, uprn: "1", uprn_known: 1, buildheightclass: 2) log.update!(nationality_all: 36, manual_address_entry_selected: false, uprn: "1", uprn_known: 1)
end end
it "exports the CSV with the 2026 ordering and all values correct" do it "exports the CSV with the 2026 ordering and all values correct" do
@ -268,7 +255,7 @@ RSpec.describe Csv::SalesLogCsvService do
index = attribute_line.index(attribute) index = attribute_line.index(attribute)
content_line[index] = nil content_line[index] = nil
end end
expect(csv[1..]).to eq expected_content[1..] # Skip the first line as it contains the definitions expect(csv).to eq expected_content
end end
end end
@ -325,24 +312,9 @@ RSpec.describe Csv::SalesLogCsvService do
expect(la_label_value).to eq "Westminster" expect(la_label_value).to eq "Westminster"
end end
context "when the requested form is 2023" do context "when the requested form is 2024", metadata: { year: 24 } do
let(:now) { Time.zone.local(2024, 1, 1) } let(:now) { collection_start_date_for_year(2024) }
let(:year) { 2023 } let(:fixed_time) { collection_start_date_for_year(2024) }
it "exports the CSV with all values correct" do
expected_content = CSV.read("spec/fixtures/files/sales_logs_csv_export_codes_23.csv")
values_to_delete = %w[ID]
values_to_delete.each do |attribute|
index = attribute_line.index(attribute)
content_line[index] = nil
end
expect(csv).to eq expected_content
end
end
context "when the requested form is 2024" do
let(:now) { Time.zone.local(2024, 5, 1) }
let(:fixed_time) { Time.zone.local(2024, 5, 1) }
let(:year) { 2024 } let(:year) { 2024 }
before do before do
@ -360,9 +332,9 @@ RSpec.describe Csv::SalesLogCsvService do
end end
end end
context "when the requested form is 2025" do context "when the requested form is 2025", metadata: { year: 25 } do
let(:now) { Time.zone.local(2025, 5, 1) } let(:now) { collection_start_date_for_year(2025) }
let(:fixed_time) { Time.zone.local(2025, 5, 1) } let(:fixed_time) { collection_start_date_for_year(2025) }
let(:year) { 2025 } let(:year) { 2025 }
before do before do
@ -380,13 +352,13 @@ RSpec.describe Csv::SalesLogCsvService do
end end
end end
context "when the requested form is 2026" do context "when the requested form is 2026", metadata: { year: 26 } do
let(:now) { Time.zone.local(2026, 5, 1) } let(:now) { collection_start_date_for_year(2026) }
let(:fixed_time) { Time.zone.local(2026, 5, 1) } let(:fixed_time) { collection_start_date_for_year(2026) }
let(:year) { 2026 } let(:year) { 2026 }
before do before do
log.update!(manual_address_entry_selected: false, uprn: "1", uprn_known: 1, buildheightclass: 2) log.update!(manual_address_entry_selected: false, uprn: "1", uprn_known: 1)
end end
it "exports the CSV with all values correct" do it "exports the CSV with all values correct" do
@ -396,7 +368,7 @@ RSpec.describe Csv::SalesLogCsvService do
index = attribute_line.index(attribute) index = attribute_line.index(attribute)
content_line[index] = nil content_line[index] = nil
end end
expect(csv[1..]).to eq expected_content[1..] # Skip the first line as it contains the definitions expect(csv).to eq expected_content
end end
end end
@ -420,10 +392,10 @@ RSpec.describe Csv::SalesLogCsvService do
expect(attribute_line).not_to include(*%w[address_line1_as_entered address_line2_as_entered town_or_city_as_entered county_as_entered postcode_full_as_entered la_as_entered created_by value_value_check monthly_charges_value_check]) expect(attribute_line).not_to include(*%w[address_line1_as_entered address_line2_as_entered town_or_city_as_entered county_as_entered postcode_full_as_entered la_as_entered created_by value_value_check monthly_charges_value_check])
end end
context "and the requested form is 2024" do context "and the requested form is 2024", metadata: { year: 24 } do
let(:year) { 2024 } let(:year) { 2024 }
let(:now) { Time.zone.local(2024, 5, 1) } let(:now) { collection_start_date_for_year(2024) }
let(:fixed_time) { Time.zone.local(2024, 5, 1) } let(:fixed_time) { collection_start_date_for_year(2024) }
before do before do
log.update!(nationality_all: 36, manual_address_entry_selected: false, uprn: "1", uprn_known: 1) log.update!(nationality_all: 36, manual_address_entry_selected: false, uprn: "1", uprn_known: 1)
@ -444,10 +416,10 @@ RSpec.describe Csv::SalesLogCsvService do
end end
end end
context "and the requested form is 2025" do context "and the requested form is 2025", metadata: { year: 25 } do
let(:year) { 2025 } let(:year) { 2025 }
let(:now) { Time.zone.local(2025, 5, 1) } let(:now) { collection_start_date_for_year(2025) }
let(:fixed_time) { Time.zone.local(2025, 5, 1) } let(:fixed_time) { collection_start_date_for_year(2025) }
before do before do
log.update!(nationality_all: 36, manual_address_entry_selected: false, uprn: "1", uprn_known: 1) log.update!(nationality_all: 36, manual_address_entry_selected: false, uprn: "1", uprn_known: 1)
@ -468,10 +440,10 @@ RSpec.describe Csv::SalesLogCsvService do
end end
end end
context "and the requested form is 2026" do context "and the requested form is 2026", metadata: { year: 26 } do
let(:year) { 2026 } let(:year) { 2026 }
let(:now) { Time.zone.local(2026, 5, 1) } let(:now) { collection_start_date_for_year(2026) }
let(:fixed_time) { Time.zone.local(2026, 5, 1) } let(:fixed_time) { collection_start_date_for_year(2026) }
before do before do
log.update!(nationality_all: 36, manual_address_entry_selected: false, uprn: "1", uprn_known: 1, buildheightclass: 2) log.update!(nationality_all: 36, manual_address_entry_selected: false, uprn: "1", uprn_known: 1, buildheightclass: 2)

Loading…
Cancel
Save