spec/lib/parser_spec.rb in biodiversity-5.9.1 vs spec/lib/parser_spec.rb in biodiversity-6.0.0
- old
+ new
@@ -25,10 +25,16 @@
expect(parsed[:authorship]).to eq 'Foo & Bar. 1758'
expect(parsed[:quality]).to eq 1
expect(parsed[:normalized]).to be_nil
end
+ it 'treats newlines as whitespaces' do # Requirement for IPC to work
+ parsed = subject.parse("\nHomo\r\nsapiens\nLinn.\r1758\n")
+ expect(parsed[:verbatim]).to eq ' Homo sapiens Linn. 1758 '
+ expect(parsed[:normalized]).to eq parsed[:verbatim].strip
+ end
+
it 'parses botanical cultivars in full form' do
parsed = subject.parse('Aus bus "White Russian"',
simple: false, with_cultivars: true)
expect(parsed[:canonical][:simple]).to eq 'Aus bus ‘White Russian’'
expect(parsed[:quality]).to eq 1
@@ -76,8 +82,16 @@
expect(parsed[1][:virus]).to be true
expect(parsed[1][:words]).to be_nil
expect(parsed[2][:canonical][:simple]).to eq 'Aus bus ‘White Russian’'
expect(parsed[2][:quality]).to eq 1
expect(parsed[2][:parserVersion]).to match(/GNparser/)
+ end
+
+ it 'treats newlines as whitespaces' do # Requirement for IPC to work
+ parsed = subject.parse_ary(["\nHomo\r\nsapiens\nLinn.\r1758\n"])
+ expect(parsed.length).to eq 1
+ parsed = parsed.first
+ expect(parsed[:verbatim]).to eq ' Homo sapiens Linn. 1758 '
+ expect(parsed[:normalized]).to eq parsed[:verbatim].strip
end
end
end