Skip to content

Commit

Permalink
Fix attr for indu (#1348)
Browse files Browse the repository at this point in the history
  • Loading branch information
pskl authored Jan 22, 2025
1 parent 5d7574f commit 5d425c0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
6 changes: 2 additions & 4 deletions app/services/asp/mappers/adresse/indu_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ module ASP
module Mappers
module Adresse
class InduMapper < FranceMapper
# Max 38 characters
def pointremise
student.address_line1.slice(0, 38)
student.address_line1
end

# Max 38 characters
def cpltdistribution
student.address_line2&.slice(0, 38)
student.address_line2
end
end
end
Expand Down
7 changes: 4 additions & 3 deletions lib/asp/entities/adresse/indu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ module ASP
module Entities
module Adresse
class Indu < Entity
attribute :pointremise, :string
attribute :cpltdistribution, :string
ADRESSE_ATTR_MAX_LENGTH = 38

attribute :pointremise, :string, limit: ADRESSE_ATTR_MAX_LENGTH
attribute :cpltdistribution, :string, limit: ADRESSE_ATTR_MAX_LENGTH
attribute :codetypeadr, :string
attribute :codecominsee, :string
attribute :codeinseepays, :string
attribute :codepostalcedex, :string

validates_presence_of %i[
pointremise
cpltdistribution
codetypeadr
codeinseepays
codepostalcedex
Expand Down
2 changes: 0 additions & 2 deletions spec/lib/asp/entities/adresse/indu_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

describe "validation" do
it { is_expected.to validate_presence_of(:pointremise) }
it { is_expected.to validate_presence_of(:cpltdistribution) }

it { is_expected.to validate_presence_of(:codepostalcedex) }
it { is_expected.to validate_presence_of(:codecominsee) }
it { is_expected.to validate_presence_of(:codeinseepays) }
Expand Down

0 comments on commit 5d425c0

Please sign in to comment.