parent
3660e01d76
commit
720a312b00
2 changed files with 4 additions and 10 deletions
|
@ -2,7 +2,7 @@ class Champs::RNFChamp < Champ
|
||||||
store_accessor :data, :title, :email, :phone, :createdAt, :updatedAt, :dissolvedAt, :address, :status
|
store_accessor :data, :title, :email, :phone, :createdAt, :updatedAt, :dissolvedAt, :address, :status
|
||||||
|
|
||||||
def rnf_id
|
def rnf_id
|
||||||
external_id&.gsub(/[:space:]/, '')
|
external_id&.gsub(/[[:space:]]/, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
def value
|
def value
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe Champs::RNFChamp, type: :model do
|
||||||
describe 'fetch_external_data' do
|
describe 'fetch_external_data' do
|
||||||
let(:url) { RNFService.new.send(:url) }
|
let(:url) { RNFService.new.send(:url) }
|
||||||
let(:status) { 200 }
|
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 }
|
subject { champ.fetch_external_data }
|
||||||
|
|
||||||
|
@ -51,20 +51,14 @@ describe Champs::RNFChamp, type: :model do
|
||||||
context 'success (with space)' do
|
context 'success (with space)' do
|
||||||
let(:external_id) { '075-FDD- 00003-01 ' }
|
let(:external_id) { '075-FDD- 00003-01 ' }
|
||||||
it {
|
it {
|
||||||
expect(subject.value!).to include({
|
expect(subject).to be_success
|
||||||
id: 3,
|
|
||||||
rnfId: '075-FDD-00003-01'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'success (with tab)' do
|
context 'success (with tab)' do
|
||||||
let(:external_id) { '075-FDD-0 0003-01 ' }
|
let(:external_id) { '075-FDD-0 0003-01 ' }
|
||||||
it {
|
it {
|
||||||
expect(subject.value!).to include({
|
expect(subject).to be_success
|
||||||
id: 3,
|
|
||||||
rnfId: '075-FDD-00003-01'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue