2022-09-21 15:18:08 +02:00
|
|
|
describe Champs::RNAChamp do
|
2022-09-22 17:13:53 +02:00
|
|
|
let(:champ) { create(:champ_rna, value: "W182736273") }
|
|
|
|
|
2022-09-21 15:18:08 +02:00
|
|
|
describe '#valid?' do
|
2023-10-26 16:02:23 +02:00
|
|
|
it { expect(build(:champ_rna, value: nil).valid?(:champs_public_value)).to be_truthy }
|
|
|
|
it { expect(build(:champ_rna, value: "2736251627").valid?(:champs_public_value)).to be_falsey }
|
|
|
|
it { expect(build(:champ_rna, value: "A172736283").valid?(:champs_public_value)).to be_falsey }
|
|
|
|
it { expect(build(:champ_rna, value: "W1827362718").valid?(:champs_public_value)).to be_falsey }
|
|
|
|
it { expect(build(:champ_rna, value: "W182736273").valid?(:champs_public_value)).to be_truthy }
|
2022-09-21 15:18:08 +02:00
|
|
|
end
|
2022-09-22 17:13:53 +02:00
|
|
|
|
|
|
|
describe "#export" do
|
|
|
|
context "with association title" do
|
|
|
|
before do
|
|
|
|
champ.update(data: { association_titre: "Super asso" })
|
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(champ.for_export).to eq("W182736273 (Super asso)") }
|
|
|
|
end
|
|
|
|
|
|
|
|
context "no association title" do
|
|
|
|
it { expect(champ.for_export).to eq("W182736273") }
|
|
|
|
end
|
|
|
|
end
|
2022-09-21 15:18:08 +02:00
|
|
|
end
|