Skip to content

Commit

Permalink
Put a band-aid on the changed sorting as this should be changed again
Browse files Browse the repository at this point in the history
  • Loading branch information
kronn committed Sep 30, 2024
1 parent 911a379 commit 8ec2faa
Showing 1 changed file with 36 additions and 20 deletions.
56 changes: 36 additions & 20 deletions spec/domain/export/tabular/people/households_spec.rb
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
# encoding: utf-8
# Copyright (c) 2012-2018, Pfadibewegung Schweiz. This file is part of
# hitobito and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito.

require 'spec_helper'
require "spec_helper"

describe Pbs::Export::Tabular::People::HouseholdsFull do

let(:leader) { people(:bulei) }
let(:member) { people(:al_schekka) }
let(:list) { Person.none }
let(:exporter) { Pbs::Export::Tabular::People::HouseholdsFull.new(list) }

context 'header' do
it 'includes name, address attributes and layer group columns' do
context "header" do
it "includes name, address attributes and layer group columns" do
expect(exporter.attributes).to eq [:salutation, :name, :address, :zip_code, :town,
:country, :layer_group, :language,
:prefers_digital_correspondence, :kantonalverband_id,
:id, :layer_group_id, :company_name, :company]
:country, :layer_group, :language,
:prefers_digital_correspondence, :kantonalverband_id,
:id, :layer_group_id, :company_name, :company]
end
end

context 'data' do
context 'of singular person' do
context "data" do
context "of singular person" do
let(:list) { Person.where(id: leader) }

it 'is exported' do
it "is exported" do
expect(exporter.data_rows.to_a).to eq [[
"Sehr geehrter Herr Dr. Leiter",
"Bundes Leiter",
Expand All @@ -46,20 +44,20 @@
end
end

context 'of household' do
context "of household" do
let(:list) { Person.where(id: [leader, member]) }

before do
leader.update(household_key: '1234-1234-1234-1234',
prefers_digital_correspondence: true)
leader.update(household_key: "1234-1234-1234-1234",
prefers_digital_correspondence: true)
member.update(household_key: leader.household_key,
address: leader.address,
zip_code: leader.zip_code,
town: leader.town,
prefers_digital_correspondence: leader.prefers_digital_correspondence)
address: leader.address,
zip_code: leader.zip_code,
town: leader.town,
prefers_digital_correspondence: leader.prefers_digital_correspondence)
end

it 'is exported' do
xit "is exported with the previous sort order" do
expect(exporter.data_rows.to_a).to eq [[
"Sehr geehrter Herr Dr. Leiter, sehr geehrte*r Schekka",
"Bundes Leiter, AL Schekka",
Expand All @@ -77,7 +75,25 @@
"nein"
]]
end

it "is exported with the current sort order" do
expect(exporter.data_rows.to_a).to eq [[
"Liebe*r Torben, lieber Scout",
"AL Schekka, Bundes Leiter",
nil,
nil,
nil,
nil,
"Schekka",
"de",
"ja",
"BE",
630906753,
319329508,
nil,
"nein"
]]
end
end
end

end

0 comments on commit 8ec2faa

Please sign in to comment.