demarches-normaliennes/spec/models/champs/address_champ_spec.rb

21 lines
590 B
Ruby
Raw Normal View History

2021-02-17 13:54:24 +01:00
describe Champs::AddressChamp do
let(:champ) { Champs::AddressChamp.new(value: value, data: data, type_de_champ: create(:type_de_champ_address)) }
let(:value) { '' }
let(:data) { nil }
context "with value but no data" do
let(:value) { 'Paris' }
it { expect(champ.address_label).to eq('Paris') }
it { expect(champ.full_address?).to be_falsey }
end
context "with value and data" do
let(:value) { 'Paris' }
let(:data) { { label: 'Paris' } }
it { expect(champ.address_label).to eq('Paris') }
it { expect(champ.full_address?).to be_truthy }
end
end