[#1421] Format value for display
This commit is contained in:
parent
55a685c183
commit
04892f6c55
2 changed files with 29 additions and 0 deletions
|
@ -15,4 +15,29 @@ describe Champs::LinkedDropDownListChamp do
|
|||
|
||||
it { expect(champ.value).to eq('["tata","tutu"]') }
|
||||
end
|
||||
|
||||
describe '#for_display' do
|
||||
let(:champ) { described_class.new(primary_value: primary_value, secondary_value: secondary_value) }
|
||||
let(:primary_value) { nil }
|
||||
let(:secondary_value) { nil }
|
||||
|
||||
subject { champ.for_display }
|
||||
|
||||
context 'with no value' do
|
||||
it { is_expected.to eq('') }
|
||||
end
|
||||
|
||||
context 'with primary value' do
|
||||
let(:primary_value) { 'primary' }
|
||||
|
||||
it { is_expected.to eq('primary') }
|
||||
end
|
||||
|
||||
context 'with secondary value' do
|
||||
let(:primary_value) { 'primary' }
|
||||
let(:secondary_value) { 'secondary' }
|
||||
|
||||
it { is_expected.to eq('primary / secondary') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue