Add DecimalNumberChamp

This commit is contained in:
Paul Chavard 2018-10-31 19:48:03 +01:00
parent 681a2e660d
commit 45bfb2fd47
8 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,25 @@
require 'spec_helper'
describe Champs::DecimalNumberChamp do
subject { Champs::DecimalNumberChamp.new(value: value) }
describe '#valid?' do
context 'when the value is integer number' do
let(:value) { 2 }
it { is_expected.to be_valid }
end
context 'when the value is decimal number' do
let(:value) { 2.6 }
it { is_expected.to be_valid }
end
context 'when the value is not a number' do
let(:value) { 'toto' }
it { is_expected.to_not be_valid }
end
end
end