diff options
Diffstat (limited to 'spec/helpers/listbox_helper_spec.rb')
-rw-r--r-- | spec/helpers/listbox_helper_spec.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/spec/helpers/listbox_helper_spec.rb b/spec/helpers/listbox_helper_spec.rb index 8935d69d4f7..0a27aa04b37 100644 --- a/spec/helpers/listbox_helper_spec.rb +++ b/spec/helpers/listbox_helper_spec.rb @@ -65,10 +65,13 @@ RSpec.describe ListboxHelper do end context 'when selected does not match any item' do - let(:selected) { 'qux' } + where(selected: [nil, 'qux']) - it 'raises an error' do - expect { subject }.to raise_error(ArgumentError, /cannot find qux/) + with_them do + it 'selects first item' do + expect(subject.at_css('button').content).to eq('Foo') + expect(subject.attributes['data-selected'].value).to eq('foo') + end end end end |