|
49 | 49 | let!(:montpellier) { Commune.create(name: 'Montpellier', code_insee: '34172') }
|
50 | 50 | let!(:baillargues) { Commune.create(name: 'Baillargues', code_insee: '34022') }
|
51 | 51 | let!(:vendargues) { Commune.create(name: 'Vendargues' , code_insee: '34327') }
|
| 52 | + let!(:perols) { Commune.create(name: 'Pérols' , code_insee: '34327') } |
52 | 53 |
|
53 | 54 | it "searches through communes by their name" do
|
54 | 55 | results = Commune.search('Montpellier')
|
55 | 56 |
|
56 | 57 | expect(results.size).to eq(1)
|
57 | 58 | expect(results).to include(montpellier)
|
58 |
| - expect(results).to_not include(baillargues) |
59 |
| - expect(results).to_not include(vendargues) |
60 | 59 | end
|
61 | 60 |
|
62 | 61 | it "searches with insensitive case" do
|
63 |
| - results = Commune.search('MoNTPelLIER') |
| 62 | + results = Commune.search('PÉROLS') |
64 | 63 |
|
65 | 64 | expect(results.size).to eq(1)
|
66 |
| - expect(results).to include(montpellier) |
67 |
| - expect(results).to_not include(baillargues) |
68 |
| - expect(results).to_not include(vendargues) |
| 65 | + expect(results).to include(perols) |
69 | 66 | end
|
70 | 67 |
|
71 | 68 | it "searches with partial name" do
|
|
74 | 71 | expect(results.size).to eq(2)
|
75 | 72 | expect(results).to include(baillargues)
|
76 | 73 | expect(results).to include(vendargues)
|
77 |
| - expect(results).to_not include(montpellier) |
78 | 74 | end
|
79 | 75 |
|
80 | 76 | it "searches and escapes special characters" do
|
81 | 77 | results = Commune.search('%argue')
|
82 | 78 |
|
83 | 79 | expect(results.size).to eq(0)
|
84 |
| - expect(results).to_not include(baillargues) |
85 |
| - expect(results).to_not include(vendargues) |
86 |
| - expect(results).to_not include(montpellier) |
87 | 80 | end
|
88 | 81 |
|
89 | 82 | it "is chainable" do
|
|
0 commit comments