spec/lib/danica/wrapper/constant_spec.rb in danica-2.4.2 vs spec/lib/danica/wrapper/constant_spec.rb in danica-2.4.3

- old
+ new

@@ -17,9 +17,39 @@ it 'has a string for latex' do expect(subject.to_tex).to eq('M') end end + describe '#to' do + context 'when requesting :tex' do + it 'has a string for latex' do + expect(subject.to(:tex)).to eq('M') + end + end + context "when requesting 'tex'" do + it 'has a string for latex' do + expect(subject.to('tex')).to eq('M') + end + end + context 'when requesting :gnu' do + it 'has a string for gnu' do + expect(subject.to(:gnu)).to eq('m') + end + end + context "when requesting 'gnu'" do + it 'has a string for gnu' do + expect(subject.to('gnu')).to eq('m') + end + end + context "when requesting wrong format" do + it do + expect do + subject.to('format') + end.to raise_error(Danica::Exception::FormatNotFound) + end + end + end + describe '#to_gnu' do it 'has a string for gnu' do expect(subject.to_gnu).to eq('m') end end