biodiversity 3.1.4 → 3.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,99 +6,155 @@ describe ScientificNameDirty do
6
6
  set_parser(ScientificNameDirtyParser.new)
7
7
  end
8
8
 
9
- it 'should parse clean names' do
10
- parse("Betula verucosa (L.) Bar. 1899").should_not be_nil
9
+ it 'parses clean names' do
10
+ expect(parse('Betula verucosa (L.) Bar. 1899')).to_not be_nil
11
11
  end
12
12
 
13
- it 'should parse double parenthesis' do
14
- sn = "Eichornia crassipes ( (Martius) ) Solms-Laub."
15
- parse(sn).should_not be_nil
16
- value(sn).should == "Eichornia crassipes (Martius) Solms-Laub."
17
- details(sn).should == [{:genus=>{:string=>"Eichornia"},
18
- :species=>{:string=>"crassipes",
19
- :authorship=>"( (Martius) ) Solms-Laub.",
20
- :combinationAuthorTeam=>{:authorTeam=>"Solms-Laub.",
21
- :author=>["Solms-Laub."]},
22
- :basionymAuthorTeam=>{:authorTeam=>"Martius",
23
- :author=>["Martius"]}}}]
24
- pos(sn).should == {0=>["genus", 9], 10=>["species", 19], 23=>["author_word", 30], 34=>["author_word", 45]}
13
+ it 'parses double parenthesis' do
14
+ sn = 'Eichornia crassipes ( (Martius) ) Solms-Laub.'
15
+ expect(parse(sn)).to_not be_nil
16
+ expect(value(sn)).to eq 'Eichornia crassipes (Martius) Solms-Laub.'
17
+ expect(details(sn)).to eq [{:genus=>{:string=>'Eichornia'},
18
+ :species=>{:string=>'crassipes',
19
+ :authorship=>'( (Martius) ) Solms-Laub.',
20
+ :combinationAuthorTeam=>{:authorTeam=>'Solms-Laub.',
21
+ :author=>['Solms-Laub.']},
22
+ :basionymAuthorTeam=>{:authorTeam=>'Martius',
23
+ :author=>['Martius']}}}]
24
+ expect(pos(sn)).to eq({0=>['genus', 9], 10=>['species', 19],
25
+ 23=>['author_word', 30], 34=>['author_word', 45]})
25
26
  end
26
27
 
27
- it "should parse year without author" do
28
- sn = "Acarospora cratericola 1929"
29
- parse(sn).should_not be_nil
30
- pos(sn).should == {0=>["genus", 10], 11=>["species", 22], 23=>["year", 27]}
31
- details(sn).should == [{:genus=>{:string=>"Acarospora"}, :species=>{:string=>"cratericola", :year=>"1929"}}]
28
+ it 'parses year without author' do
29
+ sn = 'Acarospora cratericola 1929'
30
+ expect(parse(sn)).to_not be_nil
31
+ expect(pos(sn)).to eq({0=>['genus', 10],
32
+ 11=>['species', 22], 23=>['year', 27]})
33
+ expect(details(sn)).to eq [{:genus=>{:string=>'Acarospora'},
34
+ :species=>{:string=>'cratericola',
35
+ :year=>'1929'}}]
32
36
  end
33
37
 
34
- it 'should parse double years' do
35
- sn = "Tridentella tangeroae Bruce, 1987-92"
36
- parse(sn).should_not be_nil
37
- pos(sn).should == {0=>["genus", 11], 12=>["species", 21], 22=>["author_word", 27], 29=>["year", 36]}
38
- details(sn).should == [{:genus=>{:string=>"Tridentella"}, :species=>{:string=>"tangeroae", :authorship=>"Bruce, 1987-92", :basionymAuthorTeam=>{:authorTeam=>"Bruce", :author=>["Bruce"], :year=>"1987-92"}}}]
38
+ it 'parses double years' do
39
+ sn = 'Tridentella tangeroae Bruce, 1987-92'
40
+ expect(parse(sn)).to_not be_nil
41
+ expect(pos(sn)).to eq({0=>['genus', 11], 12=>['species', 21],
42
+ 22=>['author_word', 27], 29=>['year', 36]})
43
+ expect(details(sn)).to eq [{:genus=>{:string=>'Tridentella'},
44
+ :species=>{:string=>'tangeroae', :authorship=>'Bruce, 1987-92',
45
+ :basionymAuthorTeam=>{:authorTeam=>'Bruce', :author=>['Bruce'],
46
+ :year=>'1987-92'}}}]
39
47
  end
40
48
 
41
- it 'should parse dirty years' do
42
- parse("Tridentella tangeroae Bruce, 1988B").should_not be_nil
43
- parse("Tridentella tangeroae Bruce, 1988b").should_not be_nil
44
- parse("Tridentella tangeroae Bruce, 1988d").should_not be_nil
45
- sn = "Tridentella tangeroae Bruce, 198?"
46
- parse(sn).should_not be_nil
47
- pos(sn).should == {0=>["genus", 11], 12=>["species", 21], 22=>["author_word", 27], 29=>["year", 33]}
49
+ it 'parses dirty years' do
50
+ expect(parse('Tridentella tangeroae Bruce, 1988B')).to_not be_nil
51
+ expect(parse('Tridentella tangeroae Bruce, 1988b')).to_not be_nil
52
+ expect(parse('Tridentella tangeroae Bruce, 1988d')).to_not be_nil
53
+ sn = 'Tridentella tangeroae Bruce, 198?'
54
+ expect(parse(sn)).to_not be_nil
55
+ expect(pos(sn)).to eq({0=>['genus', 11], 12=>['species', 21],
56
+ 22=>['author_word', 27], 29=>['year', 33]})
48
57
  end
49
58
 
50
- it 'should parse year with page number' do
51
- sn = "Gymnodactylus irregularis WERMUTH 1965: 54"
52
- parse(sn).should_not be_nil
53
- value(sn).should == "Gymnodactylus irregularis Wermuth 1965"
54
- details(sn).should == [{:genus=>{:string=>"Gymnodactylus"}, :species=>{:string=>"irregularis", :authorship=>"WERMUTH 1965: 54", :basionymAuthorTeam=>{:authorTeam=>"WERMUTH", :author=>["Wermuth"], :year=>"1965"}}}]
55
- pos(sn).should == {0=>["genus", 13], 14=>["species", 25], 26=>["author_word", 33], 34=>["year", 38]}
59
+ it 'parses year with page number' do
60
+ sn = 'Gymnodactylus irregularis WERMUTH 1965: 54'
61
+ expect(parse(sn)).to_not be_nil
62
+ expect(value(sn)).to eq 'Gymnodactylus irregularis Wermuth 1965'
63
+ expect(details(sn)).to eq [{:genus=>{:string=>'Gymnodactylus'},
64
+ :species=>{:string=>'irregularis', :authorship=>'WERMUTH 1965: 54',
65
+ :basionymAuthorTeam=>{:authorTeam=>'WERMUTH', :author=>['Wermuth'],
66
+ :year=>'1965'}}}]
67
+ expect(pos(sn)).to eq({0=>['genus', 13], 14=>['species', 25],
68
+ 26=>['author_word', 33], 34=>['year', 38]})
56
69
  end
57
70
 
58
- it 'should parse year with []' do
59
- parse("Anthoscopus Cabanis [1851]").should_not be_nil
60
- value("Anthoscopus Cabanis [185?]").should == "Anthoscopus Cabanis (185?)"
61
- parse("Anthoscopus Cabanis [1851?]").should_not be_nil
62
- value("Anthoscopus Cabanis [1851]").should == "Anthoscopus Cabanis (1851)"
63
- sn = "Anthoscopus Cabanis [1851?]"
64
- value(sn).should == "Anthoscopus Cabanis (1851?)"
65
- details(sn).should == [{:uninomial=>{:string=>"Anthoscopus", :authorship=>"Cabanis [1851?]", :basionymAuthorTeam=>{:authorTeam=>"Cabanis", :author=>["Cabanis"], :approximate_year=>"(1851?)"}}}]
66
- pos(sn).should == {0=>["uninomial", 11], 12=>["author_word", 19], 21=>["year", 26]}
67
- sn = "Trismegistia monodii Ando, 1973 [1974]"
68
- parse(sn).should_not be_nil
69
- value(sn).should == 'Trismegistia monodii Ando 1973 (1974)' #should it be 'Trismegistia monodii Ando 1973 (1974)' instead?
70
- details(sn).should == [{:genus=>{:string=>"Trismegistia"}, :species=>{:string=>"monodii", :authorship=>"Ando, 1973 [1974]", :basionymAuthorTeam=>{:authorTeam=>"Ando", :author=>["Ando"], :year=>"1973", :approximate_year=>"(1974)"}}}]
71
- pos(sn).should == {0=>["genus", 12], 13=>["species", 20], 21=>["author_word", 25], 27=>["year", 31], 33=>["year", 37]}
72
- parse("Zygaena witti Wiegel [1973]").should_not be_nil
73
- sn = "Deyeuxia coarctata Kunth, 1815 [1816]"
74
- parse(sn).should_not be_nil
75
- pos(sn).should == {0=>["genus", 8], 9=>["species", 18], 19=>["author_word", 24], 26=>["year", 30], 32=>["year", 36]}
71
+ it 'parses year with []' do
72
+ expect(parse('Anthoscopus Cabanis [1851]')).to_not be_nil
73
+ expect(value('Anthoscopus Cabanis [185?]')).
74
+ to eq 'Anthoscopus Cabanis (185?)'
75
+ expect(parse('Anthoscopus Cabanis [1851?]')).to_not be_nil
76
+ expect(value('Anthoscopus Cabanis [1851]')).
77
+ to eq 'Anthoscopus Cabanis (1851)'
78
+ sn = 'Anthoscopus Cabanis [1851?]'
79
+ expect(value(sn)).to eq 'Anthoscopus Cabanis (1851?)'
80
+ expect(details(sn)).to eq [{:uninomial=>{:string=>'Anthoscopus',
81
+ :authorship=>'Cabanis [1851?]', :basionymAuthorTeam=>
82
+ {:authorTeam=>'Cabanis', :author=>['Cabanis'],
83
+ :approximate_year=>'(1851?)'}}}]
84
+ expect(pos(sn)).to eq({0=>['uninomial', 11],
85
+ 12=>['author_word', 19], 21=>['year', 26]})
86
+ sn = 'Trismegistia monodii Ando, 1973 [1974]'
87
+ expect(parse(sn)).to_not be_nil
88
+
89
+ #should it be 'Trismegistia monodii Ando 1973 (1974)' instead?
90
+ expect(value(sn)).to eq 'Trismegistia monodii Ando 1973 (1974)'
91
+
92
+ expect(details(sn)).to eq [{:genus=>{:string=>'Trismegistia'},
93
+ :species=>{:string=>'monodii', :authorship=>'Ando, 1973 [1974]',
94
+ :basionymAuthorTeam=>{:authorTeam=>'Ando', :author=>['Ando'],
95
+ :year=>'1973', :approximate_year=>'(1974)'}}}]
96
+ expect(pos(sn)).to eq({0=>['genus', 12], 13=>['species', 20],
97
+ 21=>['author_word', 25], 27=>['year', 31], 33=>['year', 37]})
98
+ expect(parse('Zygaena witti Wiegel [1973]')).to_not be_nil
99
+ sn = 'Deyeuxia coarctata Kunth, 1815 [1816]'
100
+ expect(parse(sn)).to_not be_nil
101
+ expect(pos(sn)).to eq({0=>['genus', 8], 9=>['species', 18],
102
+ 19=>['author_word', 24], 26=>['year', 30],
103
+ 32=>['year', 36]})
76
104
  end
77
105
 
78
- it "should parse new stuff" do
106
+ it 'parses new stuff' do
79
107
  sn = 'Zoropsis (TaKeoa) nishimurai Yaginuma, 1971' #skipping for now
80
108
  sn = 'Campylobacter pyloridis Marshall et al.1985.'
81
- details(sn).should == [{:genus=>{:string=>"Campylobacter"}, :species=>{:string=>"pyloridis", :authorship=>"Marshall et al.1985.", :basionymAuthorTeam=>{:authorTeam=>"Marshall et al.", :author=>["Marshall et al."], :year=>"1985"}}}]
109
+ expect(details(sn)).to eq [{:genus=>{:string=>'Campylobacter'},
110
+ :species=>{:string=>'pyloridis', :authorship=>'Marshall et al.1985.',
111
+ :basionymAuthorTeam=>{:authorTeam=>'Marshall et al.',
112
+ :author=>['Marshall et al.'], :year=>'1985'}}}]
82
113
  sn = 'Beijerinckia derxii venezuelae corrig. Thompson and Skerman, 1981'
83
- details(sn).should == [{:genus=>{:string=>"Beijerinckia"}, :species=>{:string=>"derxii"}, :infraspecies=>[{:string=>"venezuelae", :rank=>"n/a", :authorship=>"Thompson and Skerman, 1981", :basionymAuthorTeam=>{:authorTeam=>"Thompson and Skerman", :author=>["Thompson", "Skerman"], :year=>"1981"}}]}]
84
- details('Streptomyces parvisporogenes ignotus 1960').should == [{:genus=>{:string=>"Streptomyces"}, :species=>{:string=>"parvisporogenes"}, :infraspecies=>[{:string=>"ignotus", :rank=>"n/a", :year=>"1960"}]}]
85
- details('Oscillaria caviae Simons 1920, according to Simons 1922').should == [{:genus=>{:string=>"Oscillaria"}, :species=>{:string=>"caviae", :authorship=>"Simons 1920", :basionymAuthorTeam=>{:authorTeam=>"Simons", :author=>["Simons"], :year=>"1920"}}}]
86
- sn = 'Bacterium monocytogenes hominis"" Nyfeldt 1932'
87
- details(sn).should == [{:genus=>{:string=>"Bacterium"}, :species=>{:string=>"monocytogenes"}, :infraspecies=>[{:string=>"hominis", :rank=>"n/a"}]}]
114
+ expect(details(sn)).to eq [{:genus=>{:string=>'Beijerinckia'},
115
+ :species=>{:string=>'derxii'}, :infraspecies=>[{:string=>'venezuelae',
116
+ :rank=>'n/a', :authorship=>'Thompson and Skerman, 1981',
117
+ :basionymAuthorTeam=>{:authorTeam=>'Thompson and Skerman',
118
+ :author=>['Thompson', 'Skerman'], :year=>'1981'}}]}]
119
+ expect(details('Streptomyces parvisporogenes ignotus 1960')).
120
+ to eq [{:genus=>{:string=>'Streptomyces'},
121
+ :species=>{:string=>'parvisporogenes'},
122
+ :infraspecies=>[{:string=>'ignotus', :rank=>'n/a', :year=>'1960'}]}]
123
+ expect(details('Oscillaria caviae Simons 1920, according to Simons 1922')).
124
+ to eq [{:genus=>{:string=>'Oscillaria'}, :species=>{:string=>'caviae',
125
+ :authorship=>'Simons 1920', :basionymAuthorTeam=>
126
+ {:authorTeam=>'Simons', :author=>['Simons'], :year=>'1920'}}}]
127
+ sn = 'Bacterium monocytogenes hominis\'\' Nyfeldt 1932'
128
+ expect(details(sn)).to eq [{:genus=>{:string=>'Bacterium'},
129
+ :species=>{:string=>'monocytogenes'},
130
+ :infraspecies=>[{:string=>'hominis', :rank=>'n/a'}]}]
88
131
  sn = 'Choriozopella trägårdhi Lawrence, 1947'
89
- details(sn).should == [{:genus=>{:string=>"Choriozopella"}, :species=>{:string=>"tragardhi", :authorship=>"Lawrence, 1947", :basionymAuthorTeam=>{:authorTeam=>"Lawrence", :author=>["Lawrence"], :year=>"1947"}}}]
132
+ expect(details(sn)).to eq [{:genus=>{:string=>'Choriozopella'},
133
+ :species=>{:string=>'tragardhi', :authorship=>'Lawrence, 1947',
134
+ :basionymAuthorTeam=>{:authorTeam=>'Lawrence', :author=>['Lawrence'],
135
+ :year=>'1947'}}}]
90
136
  sn = 'Sparassus françoisi Simon, 1898'
91
- details(sn).should == [{:genus=>{:string=>"Sparassus"}, :species=>{:string=>"francoisi", :authorship=>"Simon, 1898", :basionymAuthorTeam=>{:authorTeam=>"Simon", :author=>["Simon"], :year=>"1898"}}}]
137
+ expect(details(sn)).to eq [{:genus=>{:string=>'Sparassus'},
138
+ :species=>{:string=>'francoisi', :authorship=>'Simon, 1898',
139
+ :basionymAuthorTeam=>{:authorTeam=>'Simon', :author=>['Simon'],
140
+ :year=>'1898'}}}]
92
141
  sn = 'Dyarcyops birói Kulczynski, 1908'
93
- details(sn).should == [{:genus=>{:string=>"Dyarcyops"}, :species=>{:string=>"biroi", :authorship=>"Kulczynski, 1908", :basionymAuthorTeam=>{:authorTeam=>"Kulczynski", :author=>["Kulczynski"], :year=>"1908"}}}]
142
+ expect(details(sn)).to eq [{:genus=>{:string=>'Dyarcyops'},
143
+ :species=>{:string=>'biroi', :authorship=>'Kulczynski, 1908',
144
+ :basionymAuthorTeam=>{:authorTeam=>'Kulczynski',
145
+ :author=>['Kulczynski'], :year=>'1908'}}}]
94
146
  end
95
147
 
96
- it 'should parse names with "common" utf-8 charactes' do
97
- names = ["Rühlella","Sténométope laevissimus Bibron 1855", "Döringina Ihering 1929"].each do |name|
98
- parse(name).should_not be_nil
148
+ it 'parses names with common utf-8 charactes' do
149
+ names = ['Rühlella','Sténométope laevissimus Bibron 1855',
150
+ 'Döringina Ihering 1929'].each do |name|
151
+ expect(parse(name)).to_not be_nil
99
152
  end
100
- details("Hirsutëlla mâle").should == [{:genus=>{:string=>"Hirsutella"}, :species=>{:string=>"male"}}]
101
- details("Triticum repens vulgäre").should == [{:genus=>{:string=>"Triticum"}, :species=>{:string=>"repens"}, :infraspecies=>[{:string=>"vulgare", :rank=>"n/a"}]}]
153
+ expect(details('Hirsutëlla mâle')).to eq [{:genus=>{:string=>'Hirsutella'},
154
+ :species=>{:string=>'male'}}]
155
+ expect(details('Triticum repens vulgäre')).
156
+ to eq [{:genus=>{:string=>'Triticum'}, :species=>{:string=>'repens'},
157
+ :infraspecies=>[{:string=>'vulgare', :rank=>'n/a'}]}]
102
158
  end
103
159
 
104
160
  # AsterophUa japonica
@@ -8,11 +8,11 @@ describe ScientificNameParser do
8
8
  set_parser(ScientificNameParser.new)
9
9
  end
10
10
 
11
- it 'should return version number' do
12
- ScientificNameParser.version.should =~ /^\d+\.\d+\.\d+/
11
+ it 'returns version number' do
12
+ expect(ScientificNameParser.version).to match /^\d+\.\d+\.\d+/
13
13
  end
14
14
 
15
- it 'should ScientificNameParser::fix_case' do
15
+ it 'fixes cases' do
16
16
  names = [
17
17
  ['QUERCUS ALBA', 'Quercus alba'],
18
18
  ['QUERCUS (QUERCUS) ALBA', 'Quercus (Quercus) alba'],
@@ -20,18 +20,19 @@ describe ScientificNameParser do
20
20
  ['PARDOSA MOéSTA', 'Pardosa moésta'],
21
21
  ]
22
22
  names.each do |name, capitalization|
23
- ScientificNameParser::fix_case(name).should == capitalization
23
+ expect(ScientificNameParser::fix_case(name)).to eq capitalization
24
24
  end
25
25
  end
26
26
 
27
- it 'should generate standardized json' do
27
+ it 'generates standardized json' do
28
28
  read_test_file do |y|
29
- JSON.load(json(y[:name])).should == JSON.load(y[:jsn]) unless y[:comment]
29
+ expect(JSON.load(json(y[:name]))).to eq JSON.
30
+ load(y[:jsn]) unless y[:comment]
30
31
  end
31
32
  end
32
33
 
33
34
 
34
- # it 'should generate new test_file' do
35
+ # it 'generates new test_file' do
35
36
  # new_test = open(File.expand_path(dir +
36
37
  # '../../spec/parser/test_data_new.txt'),'w')
37
38
  # read_test_file do |y|
@@ -45,22 +46,23 @@ describe ScientificNameParser do
45
46
  # end
46
47
  # end
47
48
 
48
- it 'should generate reasonable output if parser failed' do
49
+ it 'generates reasonable output if parser failed' do
49
50
  sn = 'ddd sljlkj 3223452432'
50
- json(sn).should == '{"scientificName":{"parsed":false,' +
51
+ expect(json(sn)).to eq '{"scientificName":{"parsed":false,' +
51
52
  '"parser_version":"test_version","verbatim":"ddd sljlkj 3223452432"}}'
52
53
  end
53
54
 
54
- it 'should show version when the flag :show_version set to true' do
55
- parse('Homo sapiens')[:scientificName][:parser_version].should_not be_nil
55
+ it 'shows version when the flag :show_version set to true' do
56
+ expect(parse('Homo sapiens')[:scientificName][:parser_version]).
57
+ to_not be_nil
56
58
  end
57
59
 
58
- it 'should show version for not spelled names' do
59
- parse('not_a_name')[:scientificName][:parser_version].should_not be_nil
60
+ it 'shows version for not spelled names' do
61
+ expect(parse('not_a_name')[:scientificName][:parser_version]).to_not be_nil
60
62
  end
61
63
 
62
- it 'should generate version for viruses' do
63
- parse('Nile virus')[:scientificName][:parser_version].should_not be_nil
64
+ it 'generates version for viruses' do
65
+ expect(parse('Nile virus')[:scientificName][:parser_version]).to_not be_nil
64
66
  end
65
67
  end
66
68
 
@@ -69,7 +71,7 @@ describe 'ScientificNameParser with ranked canonicals' do
69
71
  @parser = ScientificNameParser.new(canonical_with_rank: true)
70
72
  end
71
73
 
72
- it 'should not influence output for uninomials and binomials' do
74
+ it 'does not influence output for uninomials and binomials' do
73
75
  data = [
74
76
  ['Ekbainacanthus Yakowlew 1902','Ekbainacanthus'],
75
77
  ['Ekboarmia sagnesi herrerai Exposito 2007',
@@ -78,11 +80,11 @@ describe 'ScientificNameParser with ranked canonicals' do
78
80
 
79
81
  data.each do |d|
80
82
  parsed = @parser.parse(d[0])[:scientificName][:canonical]
81
- parsed.should == d[1]
83
+ expect(parsed).to eq d[1]
82
84
  end
83
85
  end
84
86
 
85
- it 'should preserve rank for ranked multinomials' do
87
+ it 'preserves rank for ranked multinomials' do
86
88
  data = [
87
89
  ['Cola cordifolia var. puberula A. Chev.',
88
90
  'Cola cordifolia var. puberula'],
@@ -93,39 +95,39 @@ describe 'ScientificNameParser with ranked canonicals' do
93
95
  ]
94
96
  data.each do |d|
95
97
  parsed = @parser.parse(d[0])[:scientificName][:canonical]
96
- parsed.should == d[1]
98
+ expect(parsed).to eq d[1]
97
99
  end
98
100
  end
99
101
 
100
102
  end
101
103
 
102
104
  describe ParallelParser do
103
- it 'should find number of cpus' do
105
+ it 'finds number of cpus' do
104
106
  pparser = ParallelParser.new
105
- pparser.cpu_num.should > 0
107
+ expect(pparser.cpu_num).to be > 0
106
108
  end
107
109
 
108
- it 'should parse several names in parallel' do
110
+ it 'parses several names in parallel' do
109
111
  names = []
110
112
  read_test_file { |n| names << (n[:name]) if n[:name] }
111
113
  names.uniq!
112
114
  pparser = ParallelParser.new
113
115
  res = pparser.parse(names)
114
- names.size.should > 100
115
- res.keys.size.should == names.size
116
+ expect(names.size).to be > 100
117
+ expect(res.keys.size).to eq names.size
116
118
  end
117
119
 
118
- it 'should parse several names in parallel with given num of processes' do
120
+ it 'parses several names in parallel with given num of processes' do
119
121
  names = []
120
122
  read_test_file { |n| names << (n[:name]) if n[:name] }
121
123
  names.uniq!
122
124
  pparser = ParallelParser.new(4)
123
125
  res = pparser.parse(names)
124
- names.size.should > 100
125
- res.keys.size.should == names.size
126
+ expect(names.size).to be > 100
127
+ expect(res.keys.size).to eq names.size
126
128
  end
127
129
 
128
- it 'should have parsed name in native ruby format and in returned as \
130
+ it 'has parsed name in native ruby format and in returned as \
129
131
  a hash with name as a key and parsed data as value' do
130
132
  names = []
131
133
  read_test_file { |n| names << (n[:name]) if n[:name] }
@@ -133,8 +135,8 @@ describe ParallelParser do
133
135
  pparser = ParallelParser.new(4)
134
136
  res = pparser.parse(names)
135
137
  names.each_with_index do |name, i|
136
- res[name].is_a?(Hash).should be_true
137
- res[name][:scientificName][:verbatim].should == name.strip
138
+ expect(res[name].is_a?(Hash)).to be true
139
+ expect(res[name][:scientificName][:verbatim]).to eq name.strip
138
140
  end
139
141
  end
140
142
  end
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,7 @@ require 'yaml'
2
2
  require 'treetop'
3
3
  require 'json'
4
4
  require 'biodiversity'
5
+ require 'webmock/rspec'
5
6
 
6
7
 
7
8
  RSpec.configure do |c|
@@ -67,8 +68,7 @@ def debug(input)
67
68
  end
68
69
 
69
70
  def read_test_file
70
- f = open(File.expand_path(File.join(File.dirname(__FILE__),
71
- 'parser/test_data.txt')))
71
+ f = open(File.expand_path('../files/test_data.txt', __FILE__))
72
72
  f.each do |line|
73
73
  name, jsn = line.split("|")
74
74
  if line.match(/^\s*#/) == nil && name && jsn
metadata CHANGED
@@ -1,125 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biodiversity
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.4
4
+ version: 3.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Mozzherin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-19 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: treetop
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.4'
19
+ version: '1.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.4'
26
+ version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: parallel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.7'
33
+ version: '1.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.7'
40
+ version: '1.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: unicode_utils
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.4'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.4'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.3'
61
+ version: '1.6'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.3'
68
+ version: '1.6'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '10.1'
75
+ version: '10.3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '10.1'
82
+ version: '10.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '2.14'
103
+ version: '1.13'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - ~>
108
+ - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '2.14'
110
+ version: '1.13'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rr
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - ~>
115
+ - - "~>"
102
116
  - !ruby/object:Gem::Version
103
117
  version: '1.1'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - ~>
122
+ - - "~>"
109
123
  - !ruby/object:Gem::Version
110
124
  version: '1.1'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: debugger
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - ~>
129
+ - - "~>"
116
130
  - !ruby/object:Gem::Version
117
131
  version: '1.6'
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - ~>
136
+ - - "~>"
123
137
  - !ruby/object:Gem::Version
124
138
  version: '1.6'
125
139
  description: Tools for biodiversity informatics
@@ -130,10 +144,10 @@ executables:
130
144
  extensions: []
131
145
  extra_rdoc_files: []
132
146
  files:
133
- - .document
134
- - .gitignore
135
- - .ruby-version
136
- - .travis.yml
147
+ - ".document"
148
+ - ".gitignore"
149
+ - ".ruby-version"
150
+ - ".travis.yml"
137
151
  - CHANGELOG
138
152
  - Gemfile
139
153
  - LICENSE
@@ -156,13 +170,14 @@ files:
156
170
  - lib/biodiversity/version.rb
157
171
  - pkg/.gitkeep
158
172
  - spec/biodiversity_spec.rb
173
+ - spec/files/lsid.xml
174
+ - spec/files/test_data.txt
175
+ - spec/files/todo.txt
159
176
  - spec/guid/lsid.spec.rb
160
177
  - spec/parser/scientific_name_canonical_spec.rb
161
178
  - spec/parser/scientific_name_clean_spec.rb
162
179
  - spec/parser/scientific_name_dirty_spec.rb
163
180
  - spec/parser/scientific_name_spec.rb
164
- - spec/parser/test_data.txt
165
- - spec/parser/todo.txt
166
181
  - spec/spec_helper.rb
167
182
  homepage: https://github.com/GlobalNamesArchitecture/biodiversity
168
183
  licenses:
@@ -174,17 +189,17 @@ require_paths:
174
189
  - lib
175
190
  required_ruby_version: !ruby/object:Gem::Requirement
176
191
  requirements:
177
- - - '>='
192
+ - - ">="
178
193
  - !ruby/object:Gem::Version
179
194
  version: '0'
180
195
  required_rubygems_version: !ruby/object:Gem::Requirement
181
196
  requirements:
182
- - - '>='
197
+ - - ">="
183
198
  - !ruby/object:Gem::Version
184
199
  version: '0'
185
200
  requirements: []
186
201
  rubyforge_project:
187
- rubygems_version: 2.0.14
202
+ rubygems_version: 2.2.2
188
203
  signing_key:
189
204
  specification_version: 4
190
205
  summary: Parser of scientific names