Skip to content

Commit

Permalink
Merge pull request #10674 from colinux/really-fix-rnf
Browse files Browse the repository at this point in the history
ETQ usager, permet de saisir un champ RNF en ignorant les espaces/tabulations
  • Loading branch information
tchak authored Aug 1, 2024
2 parents 9d1bc79 + 720a312 commit 065000c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/models/champs/rnf_champ.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Champs::RNFChamp < Champ
store_accessor :data, :title, :email, :phone, :createdAt, :updatedAt, :dissolvedAt, :address, :status

def rnf_id
external_id&.gsub(/[:space:]/, '')
external_id&.gsub(/[[:space:]]/, '')
end

def value
Expand Down
12 changes: 3 additions & 9 deletions spec/models/champs/rnf_champ_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
describe 'fetch_external_data' do
let(:url) { RNFService.new.send(:url) }
let(:status) { 200 }
before { stub_request(:get, "#{url}/#{external_id}").to_return(body:, status:) }
before { stub_request(:get, "#{url}/075-FDD-00003-01").to_return(body:, status:) }

subject { champ.fetch_external_data }

Expand Down Expand Up @@ -51,20 +51,14 @@
context 'success (with space)' do
let(:external_id) { '075-FDD- 00003-01 ' }
it {
expect(subject.value!).to include({
id: 3,
rnfId: '075-FDD-00003-01'
})
expect(subject).to be_success
}
end

context 'success (with tab)' do
let(:external_id) { '075-FDD-0 0003-01 ' }
it {
expect(subject.value!).to include({
id: 3,
rnfId: '075-FDD-00003-01'
})
expect(subject).to be_success
}
end

Expand Down

0 comments on commit 065000c

Please sign in to comment.