diff --git a/app/views/shared/champs/multiple_drop_down_list/_show.html.haml b/app/views/shared/champs/multiple_drop_down_list/_show.html.haml index ca1e1ade2..823f33f2f 100644 --- a/app/views/shared/champs/multiple_drop_down_list/_show.html.haml +++ b/app/views/shared/champs/multiple_drop_down_list/_show.html.haml @@ -1,5 +1,4 @@ -- if champ.to_s.present? +- if !champ.blank? %ul - - champ.to_s.split(", ").each do |item| - %li - = item + - champ.selected_options.each do |item| + %li= item diff --git a/spec/views/shared/champs/multiple_drop_down_list/_show.html.haml_spec.rb b/spec/views/shared/champs/multiple_drop_down_list/_show.html.haml_spec.rb new file mode 100644 index 000000000..0ac7529b6 --- /dev/null +++ b/spec/views/shared/champs/multiple_drop_down_list/_show.html.haml_spec.rb @@ -0,0 +1,10 @@ +describe 'views/shared/champs/multiple_drop_down_list/_show.html.haml', type: :view do + let(:champ) { build(:champ_multiple_drop_down_list, value: ['abc', '2, 3, 4']) } + + subject { render partial: 'shared/champs/multiple_drop_down_list/show', locals: { champ: champ } } + + it 'renders the view' do + subject + expect(rendered).to have_selector('li', count: champ.selected_options.size) + end +end