Improve rna champ tests

This commit is contained in:
Damien Le Thiec 2022-10-04 17:19:30 +02:00
parent e694ff1f60
commit fa1f0fc240
3 changed files with 8 additions and 10 deletions

View file

@ -12,7 +12,7 @@ describe APIEducation::AnnuaireEducationAdapter do
let(:body) { File.read('spec/fixtures/files/api_education/annuaire_education.json') } let(:body) { File.read('spec/fixtures/files/api_education/annuaire_education.json') }
let(:status) { 200 } let(:status) { 200 }
it '#to_params return vaid hash' do it '#to_params return valid hash' do
expect(subject).to be_an_instance_of(Hash) expect(subject).to be_an_instance_of(Hash)
expect(subject['identifiant_de_l_etablissement']).to eq(search_term) expect(subject['identifiant_de_l_etablissement']).to eq(search_term)
expect(subject['code_type_contrat_prive']).to eq(99) expect(subject['code_type_contrat_prive']).to eq(99)
@ -23,7 +23,7 @@ describe APIEducation::AnnuaireEducationAdapter do
let(:body) { File.read('spec/fixtures/files/api_education/annuaire_education_bug.json') } let(:body) { File.read('spec/fixtures/files/api_education/annuaire_education_bug.json') }
let(:status) { 200 } let(:status) { 200 }
it '#to_params return vaid hash' do it '#to_params return valid hash' do
expect(subject).to be_an_instance_of(Hash) expect(subject).to be_an_instance_of(Hash)
expect(subject['identifiant_de_l_etablissement']).to eq(search_term) expect(subject['identifiant_de_l_etablissement']).to eq(search_term)
expect(subject['code_type_contrat_prive']).to eq(99) expect(subject['code_type_contrat_prive']).to eq(99)

View file

@ -24,7 +24,7 @@ describe APIEntreprise::RNAAdapter do
let(:body) { File.read('spec/fixtures/files/api_entreprise/associations.json') } let(:body) { File.read('spec/fixtures/files/api_entreprise/associations.json') }
let(:status) { 200 } let(:status) { 200 }
it '#to_params return vaid hash' do it '#to_params return valid hash' do
expect(subject).to be_an_instance_of(Hash) expect(subject).to be_an_instance_of(Hash)
expect(subject["association_rna"]).to eq('W595001988') expect(subject["association_rna"]).to eq('W595001988')
expect(subject["association_titre"]).to eq('UN SUR QUATRE') expect(subject["association_titre"]).to eq('UN SUR QUATRE')

View file

@ -2,13 +2,11 @@ describe Champs::RNAChamp do
let(:champ) { create(:champ_rna, value: "W182736273") } let(:champ) { create(:champ_rna, value: "W182736273") }
describe '#valid?' do describe '#valid?' do
it do it { expect(build(:champ_rna, value: nil)).to be_valid }
expect(build(:champ_rna, value: nil)).to be_valid it { expect(build(:champ_rna, value: "2736251627")).to_not be_valid }
expect(build(:champ_rna, value: "2736251627")).to_not be_valid it { expect(build(:champ_rna, value: "A172736283")).to_not be_valid }
expect(build(:champ_rna, value: "A172736283")).to_not be_valid it { expect(build(:champ_rna, value: "W1827362718")).to_not be_valid }
expect(build(:champ_rna, value: "W1827362718")).to_not be_valid it { expect(build(:champ_rna, value: "W182736273")).to be_valid }
expect(build(:champ_rna, value: "W182736273")).to be_valid
end
end end
describe "#export" do describe "#export" do