spec/name-spotter_spec.rb in name-spotter-0.0.5 vs spec/name-spotter_spec.rb in name-spotter-0.0.6
- old
+ new
@@ -43,9 +43,22 @@
res = @neti.find(text)[:names].map { |n| n[:scientificName] }
res.should == ["Betula alba", "Mus musculus", "B. alba", "Varanus bitatawa"]
res = @tf.find(text)[:names].map { |n| n[:scientificName] }
res.should == ["Betula alba", "Mus musculus", "B[etula] alba", "Varanus"]
end
+
+ it "should not remember previous search results" do
+ text = "Some text that has Betula\n alba and Mus musculus and \neven B. alba and even M. mus-\nculus. Also it has name unknown before: Varanus bitatawa species"
+ res = @neti.find(text)[:names].map { |n| n[:scientificName] }
+ res.should == ["Betula alba", "Mus musculus", "B. alba", "Varanus bitatawa"]
+ res = @tf.find(text)[:names].map { |n| n[:scientificName] }
+ res.should == ["Betula alba", "Mus musculus", "B[etula] alba", "Varanus"]
+ text = "Some another text that has Xysticus \ncanadensis and Pardosa moesta and \neven X. canadensis and even P. mo-\nesta."
+ res = @neti.find(text)[:names].map { |n| n[:scientificName] }
+ res.should == ['Xysticus canadensis', 'Pardosa moesta', 'X. canadensis']
+ res = @tf.find(text)[:names].map { |n| n[:scientificName] }
+ res.should == ['Xysticus canadensis', 'Pardosa moesta', 'X[ysticus] canadensis']
+ end
it "should get back correct names using offsets in utf-8 based text" do
text = "A text with multibyte characters नेति नेति: Some text that has Betula\n alba and Mus musculus and \neven B. alba and even M. mus-\nculus. Also it has name unknown before: Varanus bitatawa species"
res = @neti.find(text)[:names]
res.map do |name|