|
6 | 6 | let(:indices) { [index_a, index_b] }
|
7 | 7 | let(:index_a) { double 'Index A', :model => model_a, :type => 'plain',
|
8 | 8 | :sources => [double(:fields => [field_a1, field_a2])] }
|
9 |
| - let(:index_b) { double 'Index B', :model => model_a, :type => 'rt', |
| 9 | + let(:index_b) { double 'Index B', :model => model_b, :type => 'rt', |
10 | 10 | :fields => [field_b1, field_b2] }
|
11 | 11 | let(:field_a1) { double :name => 'sphinx_internal_class_name' }
|
12 | 12 | let(:field_a2) { double :name => 'name' }
|
|
38 | 38 | expect(index_b.fields).to eq([field_b2])
|
39 | 39 | end
|
40 | 40 |
|
41 |
| - it 'removes the class name fields only for the indices without type column' do |
| 41 | + it 'removes the class name fields only for the rt indices without type column' do |
42 | 42 | allow(model_a).to receive(:column_names).and_return(['id', 'name', 'type'])
|
43 | 43 | allow(model_b).to receive(:column_names).and_return(['id', 'name'])
|
44 | 44 |
|
|
47 | 47 | expect(index_a.sources.first.fields).to eq([field_a1, field_a2])
|
48 | 48 | expect(index_b.fields).to eq([field_b2])
|
49 | 49 | end
|
| 50 | + |
| 51 | + it 'removes the class name fields only for the plain indices without type column' do |
| 52 | + allow(model_a).to receive(:column_names).and_return(['id', 'name']) |
| 53 | + allow(model_b).to receive(:column_names).and_return(['id', 'name', 'type']) |
| 54 | + |
| 55 | + subject.reconcile |
| 56 | + |
| 57 | + expect(index_a.sources.first.fields).to eq([field_a2]) |
| 58 | + expect(index_b.fields).to eq([field_b1, field_b2]) |
| 59 | + end |
50 | 60 | end
|
0 commit comments