champs: put champ label in numeric fields validation messages
Replaces > La valeur du champ doit être un nombre entier (sans chiffres après > la virgule) by > La valeur du champ « Nombre de parents » doit être un nombre entier > (sans chiffres après la virgule)
This commit is contained in:
parent
56c846900b
commit
10065df8ce
4 changed files with 20 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Champs::DecimalNumberChamp do
|
||||
subject { Champs::DecimalNumberChamp.new(value: value) }
|
||||
subject { build(:champ_decimal_number, value: value).tap(&:valid?) }
|
||||
|
||||
describe '#valid?' do
|
||||
context 'when the value is integer number' do
|
||||
|
@ -20,6 +20,7 @@ describe Champs::DecimalNumberChamp do
|
|||
let(:value) { 'toto' }
|
||||
|
||||
it { is_expected.to_not be_valid }
|
||||
it { expect(subject.errors[:value]).to eq(["« #{subject.libelle} » doit être un nombre"]) }
|
||||
end
|
||||
|
||||
context 'when the value is blank' do
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Champs::IntegerNumberChamp do
|
||||
subject { Champs::IntegerNumberChamp.new(value: value) }
|
||||
subject { build(:champ_integer_number, value: value).tap(&:valid?) }
|
||||
|
||||
describe '#valid?' do
|
||||
context 'when the value is integer number' do
|
||||
|
@ -14,12 +14,14 @@ describe Champs::IntegerNumberChamp do
|
|||
let(:value) { 2.6 }
|
||||
|
||||
it { is_expected.to_not be_valid }
|
||||
it { expect(subject.errors[:value]).to eq(["« #{subject.libelle} » doit être un nombre entier (sans chiffres après la virgule)"]) }
|
||||
end
|
||||
|
||||
context 'when the value is not a number' do
|
||||
let(:value) { 'toto' }
|
||||
|
||||
it { is_expected.to_not be_valid }
|
||||
it { expect(subject.errors[:value]).to eq(["« #{subject.libelle} » doit être un nombre entier (sans chiffres après la virgule)"]) }
|
||||
end
|
||||
|
||||
context 'when the value is blank' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue