2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-10-20 17:34:59 +02:00
|
|
|
describe Champs::EngagementJuridiqueChamp do
|
|
|
|
describe 'validation' do
|
2024-07-01 15:31:32 +02:00
|
|
|
let(:champ) do
|
|
|
|
described_class
|
|
|
|
.new(dossier: build(:dossier))
|
|
|
|
.tap { _1.value = value }
|
|
|
|
end
|
2024-09-19 11:09:01 +02:00
|
|
|
before { allow(champ).to receive(:type_de_champ).and_return(build(:type_de_champ_engagement_juridique)) }
|
2024-04-01 07:17:39 +02:00
|
|
|
subject { champ.validate(:champs_public_value) }
|
2023-10-20 17:34:59 +02:00
|
|
|
|
|
|
|
context 'with [A-Z]' do
|
|
|
|
let(:value) { "ABC" }
|
|
|
|
it { is_expected.to be_truthy }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with [0-9]' do
|
|
|
|
let(:value) { "ABC" }
|
|
|
|
it { is_expected.to be_truthy }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with -' do
|
|
|
|
let(:value) { "-" }
|
|
|
|
it { is_expected.to be_truthy }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with _' do
|
|
|
|
let(:value) { "_" }
|
|
|
|
it { is_expected.to be_truthy }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with +' do
|
|
|
|
let(:value) { "+" }
|
|
|
|
it { is_expected.to be_truthy }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with /' do
|
|
|
|
let(:value) { "/" }
|
|
|
|
it { is_expected.to be_truthy }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with *' do
|
|
|
|
let(:value) { "*" }
|
|
|
|
it { is_expected.to be_falsey }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|