|
8 | 8 | taxon_name: create(:taxon_name, scientific_name: 'Aaa') |
9 | 9 | ) |
10 | 10 | end |
| 11 | + |
11 | 12 | let!(:taxon_concept2) do |
12 | 13 | create_cites_eu_family( |
13 | 14 | taxon_name: create(:taxon_name, scientific_name: 'Aac'), |
14 | 15 | parent: taxon_concept1 |
15 | 16 | ) |
16 | 17 | end |
| 18 | + |
17 | 19 | let!(:taxon_concept3) do |
18 | 20 | create_cites_eu_subfamily( |
19 | 21 | taxon_name: create(:taxon_name, scientific_name: 'Aab'), |
|
32 | 34 | parent: taxon_concept3 |
33 | 35 | ) |
34 | 36 | end |
| 37 | + |
35 | 38 | let!(:hybrid) do |
36 | | - tmp = create_cites_eu_genus( |
| 39 | + hybrid_genus = create_cites_eu_genus( |
37 | 40 | taxon_name: create(:taxon_name, scientific_name: 'Abc'), |
38 | 41 | name_status: 'H' |
39 | 42 | ) |
| 43 | + |
40 | 44 | create( |
41 | 45 | :taxon_relationship, |
42 | 46 | taxon_concept: taxon_concept4, |
43 | | - other_taxon_concept: tmp, |
| 47 | + other_taxon_concept: hybrid_genus, |
44 | 48 | taxon_relationship_type: hybrid_relationship_type |
45 | 49 | ) |
46 | | - tmp |
| 50 | + |
| 51 | + hybrid_genus |
47 | 52 | end |
| 53 | + |
48 | 54 | context 'when name status not specified' do |
49 | 55 | let(:matcher_params) do |
50 | 56 | SearchParams.new(taxonomy: { id: taxonomy.id }, scientific_name: 'Ab') |
51 | 57 | end |
| 58 | + |
52 | 59 | let(:matcher) { TaxonConceptPrefixMatcher.new matcher_params } |
53 | 60 | specify { expect(matcher.taxon_concepts).to include(taxon_concept4) } |
54 | 61 | specify { expect(matcher.taxon_concepts).not_to include(hybrid) } |
|
58 | 65 | let(:matcher_params) do |
59 | 66 | SearchParams.new(taxonomy: { id: taxonomy.id }, scientific_name: 'Ab', name_status: 'H') |
60 | 67 | end |
| 68 | + |
61 | 69 | let(:matcher) { TaxonConceptPrefixMatcher.new matcher_params } |
| 70 | + |
62 | 71 | specify { expect(matcher.taxon_concepts).not_to include(taxon_concept4) } |
63 | 72 | specify { expect(matcher.taxon_concepts).to include(hybrid) } |
64 | 73 | end |
|
71 | 80 | scientific_name: 'A' |
72 | 81 | ) |
73 | 82 | end |
| 83 | + |
74 | 84 | let(:parent_matcher) do |
75 | 85 | TaxonConceptPrefixMatcher.new parent_matcher_params |
76 | 86 | end |
|
88 | 98 | scientific_name: 'AAA' |
89 | 99 | ) |
90 | 100 | end |
| 101 | + |
91 | 102 | let(:ancestor_matcher) do |
92 | 103 | TaxonConceptPrefixMatcher.new ancestor_matcher_params |
93 | 104 | end |
|
105 | 116 | scientific_name: 'AAA' |
106 | 117 | ) |
107 | 118 | end |
| 119 | + |
108 | 120 | let(:self_and_ancestor_matcher) do |
109 | 121 | TaxonConceptPrefixMatcher.new self_and_ancestor_matcher_params |
110 | 122 | end |
|
140 | 152 | scientific_name: 'A' |
141 | 153 | ) |
142 | 154 | end |
| 155 | + |
143 | 156 | let(:descendant_matcher) do |
144 | 157 | TaxonConceptPrefixMatcher.new descendant_matcher_params |
145 | 158 | end |
|
0 commit comments