bug(Champs::DecimalNumberChamp.for_export): should be able to cast a number wrapped with a string having leading/trailing spaces
This commit is contained in:
parent
828c539469
commit
476c7df160
1 changed files with 17 additions and 0 deletions
|
@ -51,4 +51,21 @@ describe Champs::DecimalNumberChamp do
|
|||
it { is_expected.to be_truthy }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'for_export' do
|
||||
let(:champ) { create(:champ_decimal_number, value:) }
|
||||
subject { champ.for_export }
|
||||
context 'with nil' do
|
||||
let(:value) { 0 }
|
||||
it { is_expected.to be_nil }
|
||||
end
|
||||
context 'with simple number' do
|
||||
let(:value) { "120" }
|
||||
it { is_expected.to eq(120) }
|
||||
end
|
||||
context 'with nuber with space' do
|
||||
let(:value) { " 120 " }
|
||||
it { is_expected.to eq(120) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue