Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(champ): remove stable_id delegate to type_de_champ #10327

Merged
merged 2 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/models/champ.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class Champ < ApplicationRecord
:siret?,
:carte?,
:datetime?,
:stable_id,
:mandatory?,
:prefillable?,
:refresh_after_update?,
Expand Down
35 changes: 0 additions & 35 deletions spec/models/champ_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -496,41 +496,6 @@
expect(champ_text_row_1.dossier_id).to eq(champ.dossier_id)
end
end

context 'when updating using nested attributes' do
subject do
dossier.update!(champs_public_attributes: [
{
id: champ.id,
champs_attributes: [champ_text_attrs]
}
])
champ.reload
dossier.reload
end

it 'associates nested champs to the parent dossier' do
subject

expect(dossier.champs_public.size).to eq(2)
expect(champ.rows.size).to eq(2)
second_row = champ.reload.rows.second
expect(second_row.size).to eq(1)
expect(second_row.first.dossier).to eq(dossier)

champ.champs << champ_integer
first_row = champ.reload.rows.first
expect(first_row.size).to eq(2)
expect(first_row.second).to eq(champ_integer)

champ.champs << champ_text
first_row = champ.reload.rows.first
expect(first_row.size).to eq(2)
expect(first_row.first).to eq(champ_text)

expect(champ.rows.size).to eq(2)
end
end
end

describe '#log_fetch_external_data_exception' do
Expand Down
2 changes: 1 addition & 1 deletion spec/models/champs/carte_champ_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
let(:feature_collection) {
{
type: 'FeatureCollection',
id: champ.type_de_champ.stable_id,
id: champ.stable_id,
bbox: champ.bounding_box,
features: features
}
Expand Down