chewy 0.10.1 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +25 -25
  3. data/.travis.yml +21 -29
  4. data/Appraisals +27 -9
  5. data/CHANGELOG.md +36 -0
  6. data/Gemfile +3 -1
  7. data/README.md +73 -23
  8. data/chewy.gemspec +6 -8
  9. data/gemfiles/rails.4.0.activerecord.gemfile +1 -0
  10. data/gemfiles/rails.4.1.activerecord.gemfile +1 -0
  11. data/gemfiles/rails.4.2.activerecord.gemfile +1 -0
  12. data/gemfiles/{rails.4.2.mongoid.5.1.gemfile → rails.4.2.mongoid.5.2.gemfile} +2 -1
  13. data/gemfiles/rails.5.0.activerecord.gemfile +2 -1
  14. data/gemfiles/{rails.5.0.mongoid.6.0.gemfile → rails.5.0.mongoid.6.1.gemfile} +3 -2
  15. data/gemfiles/rails.5.1.activerecord.gemfile +2 -1
  16. data/gemfiles/{rails.5.1.mongoid.6.1.gemfile → rails.5.1.mongoid.6.3.gemfile} +3 -2
  17. data/gemfiles/rails.5.2.activerecord.gemfile +16 -0
  18. data/gemfiles/sequel.4.45.gemfile +2 -2
  19. data/lib/chewy.rb +1 -0
  20. data/lib/chewy/config.rb +8 -19
  21. data/lib/chewy/fields/base.rb +15 -3
  22. data/lib/chewy/fields/root.rb +13 -9
  23. data/lib/chewy/index.rb +1 -1
  24. data/lib/chewy/index/actions.rb +14 -12
  25. data/lib/chewy/index/settings.rb +2 -0
  26. data/lib/chewy/index/specification.rb +12 -10
  27. data/lib/chewy/minitest/helpers.rb +6 -6
  28. data/lib/chewy/minitest/search_index_receiver.rb +17 -17
  29. data/lib/chewy/query.rb +135 -96
  30. data/lib/chewy/query/filters.rb +20 -3
  31. data/lib/chewy/query/loading.rb +0 -1
  32. data/lib/chewy/railtie.rb +2 -4
  33. data/lib/chewy/rake_helper.rb +5 -5
  34. data/lib/chewy/rspec/update_index.rb +3 -5
  35. data/lib/chewy/search.rb +2 -2
  36. data/lib/chewy/search/parameters/concerns/query_storage.rb +4 -3
  37. data/lib/chewy/stash.rb +30 -21
  38. data/lib/chewy/strategy/atomic.rb +1 -1
  39. data/lib/chewy/type.rb +2 -2
  40. data/lib/chewy/type/adapter/base.rb +9 -9
  41. data/lib/chewy/type/adapter/mongoid.rb +1 -3
  42. data/lib/chewy/type/adapter/sequel.rb +4 -6
  43. data/lib/chewy/type/crutch.rb +1 -1
  44. data/lib/chewy/type/import.rb +3 -2
  45. data/lib/chewy/type/import/bulk_builder.rb +1 -1
  46. data/lib/chewy/type/import/journal_builder.rb +3 -3
  47. data/lib/chewy/type/import/routine.rb +2 -2
  48. data/lib/chewy/type/mapping.rb +40 -34
  49. data/lib/chewy/type/observe.rb +13 -9
  50. data/lib/chewy/type/syncer.rb +2 -2
  51. data/lib/chewy/type/witchcraft.rb +2 -2
  52. data/lib/chewy/type/wrapper.rb +2 -2
  53. data/lib/chewy/version.rb +1 -1
  54. data/lib/sequel/plugins/chewy_observe.rb +4 -19
  55. data/spec/chewy/config_spec.rb +16 -0
  56. data/spec/chewy/fields/base_spec.rb +61 -65
  57. data/spec/chewy/fields/root_spec.rb +13 -13
  58. data/spec/chewy/index/actions_spec.rb +37 -5
  59. data/spec/chewy/index/specification_spec.rb +25 -16
  60. data/spec/chewy/index_spec.rb +61 -8
  61. data/spec/chewy/journal_spec.rb +11 -11
  62. data/spec/chewy/query/filters_spec.rb +1 -1
  63. data/spec/chewy/query/nodes/not_spec.rb +1 -0
  64. data/spec/chewy/query_spec.rb +3 -2
  65. data/spec/chewy/rake_helper_spec.rb +46 -33
  66. data/spec/chewy/search_spec.rb +20 -10
  67. data/spec/chewy/stash_spec.rb +1 -1
  68. data/spec/chewy/strategy/shoryuken_spec.rb +2 -0
  69. data/spec/chewy/type/import/journal_builder_spec.rb +8 -8
  70. data/spec/chewy/type/import_spec.rb +6 -0
  71. data/spec/chewy/type/mapping_spec.rb +48 -17
  72. data/spec/spec_helper.rb +8 -0
  73. metadata +26 -25
@@ -6,7 +6,7 @@ describe Chewy::Index::Specification do
6
6
  let(:index1) do
7
7
  stub_index(:places) do
8
8
  define_type(:city) do
9
- field :name, type: 'string'
9
+ field :founded_on, type: 'date'
10
10
  end
11
11
  end
12
12
  end
@@ -15,7 +15,7 @@ describe Chewy::Index::Specification do
15
15
  stub_index(:places) do
16
16
  settings analyzer: {}
17
17
  define_type(:city) do
18
- field :name, type: 'string'
18
+ field :founded_on, type: 'date'
19
19
  end
20
20
  end
21
21
  end
@@ -23,7 +23,7 @@ describe Chewy::Index::Specification do
23
23
  let(:index3) do
24
24
  stub_index(:places) do
25
25
  define_type(:city) do
26
- field :name, type: 'string'
26
+ field :founded_on, type: 'date'
27
27
  field :population, type: 'integer'
28
28
  end
29
29
  end
@@ -33,7 +33,7 @@ describe Chewy::Index::Specification do
33
33
  stub_index(:places) do
34
34
  define_type(:city) do
35
35
  field :population, type: 'integer'
36
- field :name, type: 'string'
36
+ field :founded_on, type: 'date'
37
37
  end
38
38
  end
39
39
  end
@@ -55,11 +55,14 @@ describe Chewy::Index::Specification do
55
55
  describe '#lock!' do
56
56
  specify do
57
57
  expect { specification1.lock! }.to change { Chewy::Stash::Specification.all.hits }.from([]).to([{
58
- '_index' => 'chewy_stash',
58
+ '_index' => 'chewy_specifications',
59
59
  '_type' => 'specification',
60
60
  '_id' => 'places',
61
61
  '_score' => 1.0,
62
- '_source' => {'value' => '{"settings":{"index":{"number_of_shards":1,"number_of_replicas":0}},"mappings":{"city":{"properties":{"name":{"type":"string"}}}}}'}
62
+ '_source' => {'specification' => Base64.encode64({
63
+ 'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
64
+ 'mappings' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}}}}
65
+ }.to_json)}
63
66
  }])
64
67
  end
65
68
 
@@ -68,17 +71,23 @@ describe Chewy::Index::Specification do
68
71
 
69
72
  specify do
70
73
  expect { specification5.lock! }.to change { Chewy::Stash::Specification.all.hits }.to([{
71
- '_index' => 'chewy_stash',
74
+ '_index' => 'chewy_specifications',
72
75
  '_type' => 'specification',
73
76
  '_id' => 'places',
74
77
  '_score' => 1.0,
75
- '_source' => {'value' => '{"settings":{"index":{"number_of_shards":1,"number_of_replicas":0}},"mappings":{"city":{"properties":{"name":{"type":"string"}}}}}'}
78
+ '_source' => {'specification' => Base64.encode64({
79
+ 'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
80
+ 'mappings' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}}}}
81
+ }.to_json)}
76
82
  }, {
77
- '_index' => 'chewy_stash',
83
+ '_index' => 'chewy_specifications',
78
84
  '_type' => 'specification',
79
85
  '_id' => 'namespace/cities',
80
86
  '_score' => 1.0,
81
- '_source' => {'value' => '{"settings":{"index":{"number_of_shards":1,"number_of_replicas":0}},"mappings":{"city":{"properties":{"population":{"type":"integer"}}}}}'}
87
+ '_source' => {'specification' => Base64.encode64({
88
+ 'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
89
+ 'mappings' => {'city' => {'properties' => {'population' => {'type' => 'integer'}}}}
90
+ }.to_json)}
82
91
  }])
83
92
  end
84
93
  end
@@ -88,7 +97,7 @@ describe Chewy::Index::Specification do
88
97
  specify do
89
98
  expect { specification1.lock! }.to change { specification1.locked }.from({}).to(
90
99
  'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
91
- 'mappings' => {'city' => {'properties' => {'name' => {'type' => 'string'}}}}
100
+ 'mappings' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}}}}
92
101
  )
93
102
  end
94
103
 
@@ -105,20 +114,20 @@ describe Chewy::Index::Specification do
105
114
  specify do
106
115
  expect { specification2.lock! }.to change { specification2.locked }.from(
107
116
  'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
108
- 'mappings' => {'city' => {'properties' => {'name' => {'type' => 'string'}}}}
117
+ 'mappings' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}}}}
109
118
  ).to(
110
119
  'settings' => {'analyzer' => {}, 'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
111
- 'mappings' => {'city' => {'properties' => {'name' => {'type' => 'string'}}}}
120
+ 'mappings' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}}}}
112
121
  )
113
122
  end
114
123
 
115
124
  specify do
116
125
  expect { specification3.lock! }.to change { specification3.locked }.from(
117
126
  'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
118
- 'mappings' => {'city' => {'properties' => {'name' => {'type' => 'string'}}}}
127
+ 'mappings' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}}}}
119
128
  ).to(
120
129
  'settings' => {'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}},
121
- 'mappings' => {'city' => {'properties' => {'name' => {'type' => 'string'}, 'population' => {'type' => 'integer'}}}}
130
+ 'mappings' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}, 'population' => {'type' => 'integer'}}}}
122
131
  )
123
132
  end
124
133
  end
@@ -127,7 +136,7 @@ describe Chewy::Index::Specification do
127
136
  describe '#current' do
128
137
  specify do
129
138
  expect(specification2.current).to eq(
130
- 'mappings' => {'city' => {'properties' => {'name' => {'type' => 'string'}}}},
139
+ 'mappings' => {'city' => {'properties' => {'founded_on' => {'type' => 'date'}}}},
131
140
  'settings' => {'analyzer' => {}, 'index' => {'number_of_shards' => 1, 'number_of_replicas' => 0}}
132
141
  )
133
142
  end
@@ -191,16 +191,44 @@ describe Chewy::Index do
191
191
  stub_index(:places) do
192
192
  def self.by_rating; end
193
193
 
194
- def self.by_name; end
194
+ def self.colors(*colors)
195
+ filter(terms: {colors: colors.flatten(1).map(&:to_s)})
196
+ end
195
197
 
196
198
  define_type :city do
197
199
  def self.by_id; end
200
+ field :colors
198
201
  end
199
202
  end
200
203
  end
201
204
 
202
205
  specify { expect(described_class.scopes).to eq([]) }
203
- specify { expect(PlacesIndex.scopes).to match_array(%i[by_rating by_name]) }
206
+ specify { expect(PlacesIndex.scopes).to match_array(%i[by_rating colors]) }
207
+
208
+ context do
209
+ before do
210
+ Chewy.massacre
211
+ PlacesIndex::City.import!(
212
+ double(colors: ['red']),
213
+ double(colors: %w[red green]),
214
+ double(colors: %w[green yellow])
215
+ )
216
+ end
217
+
218
+ specify do
219
+ # This `blank?`` call is for the messed scopes bug reproduction. See #573
220
+ PlacesIndex::City.blank?
221
+ expect(PlacesIndex.colors(:green).map(&:colors))
222
+ .to contain_exactly(%w[red green], %w[green yellow])
223
+ end
224
+
225
+ specify do
226
+ # This `blank?` call is for the messed scopes bug reproduction. See #573
227
+ PlacesIndex::City.blank?
228
+ expect(PlacesIndex::City.colors(:green).map(&:colors))
229
+ .to contain_exactly(%w[red green], %w[green yellow])
230
+ end
231
+ end
204
232
  end
205
233
 
206
234
  describe '.settings_hash' do
@@ -216,17 +244,17 @@ describe Chewy::Index do
216
244
  specify do
217
245
  expect(stub_index(:documents) do
218
246
  define_type :document do
219
- field :name, type: 'string'
247
+ field :date, type: 'date'
220
248
  end
221
- end.mappings_hash).to eq(mappings: {document: {properties: {name: {type: 'string'}}}})
249
+ end.mappings_hash).to eq(mappings: {document: {properties: {date: {type: 'date'}}}})
222
250
  end
223
251
  specify do
224
252
  expect(stub_index(:documents) do
225
253
  define_type :document do
226
- field :name, type: 'string'
254
+ field :name
227
255
  end
228
256
  define_type :document2 do
229
- field :name, type: 'string'
257
+ field :name
230
258
  end
231
259
  end.mappings_hash[:mappings].keys).to match_array(%i[document document2])
232
260
  end
@@ -240,7 +268,7 @@ describe Chewy::Index do
240
268
  specify do
241
269
  expect(stub_index(:documents) do
242
270
  define_type :document do
243
- field :name, type: 'string'
271
+ field :name
244
272
  end
245
273
  end.specification_hash.keys).to eq([:mappings])
246
274
  end
@@ -248,7 +276,7 @@ describe Chewy::Index do
248
276
  expect(stub_index(:documents) do
249
277
  settings number_of_shards: 1
250
278
  define_type :document do
251
- field :name, type: 'string'
279
+ field :name
252
280
  end
253
281
  end.specification_hash.keys).to match_array(%i[mappings settings])
254
282
  end
@@ -281,4 +309,29 @@ describe Chewy::Index do
281
309
  specify { expect(DummiesIndex.index_name).to eq('borogoves_dummies') }
282
310
  end
283
311
  end
312
+
313
+ context 'index call inside index', :orm do
314
+ before do
315
+ stub_index(:cities) do
316
+ define_type :city do
317
+ field :country_name, value: (lambda do |city|
318
+ CountriesIndex::Country.filter(term: {_id: city.country_id}).first.name
319
+ end)
320
+ end
321
+ end
322
+
323
+ stub_index(:countries) do
324
+ define_type :country do
325
+ field :name
326
+ end
327
+ end
328
+
329
+ CountriesIndex::Country.import!(double(id: 1, name: 'Country'))
330
+ end
331
+
332
+ specify do
333
+ expect { CitiesIndex::City.import!(double(country_id: 1)) }
334
+ .to update_index(CitiesIndex::City).and_reindex(country_name: 'Country')
335
+ end
336
+ end
284
337
  end
@@ -51,7 +51,7 @@ describe Chewy::Journal do
51
51
 
52
52
  places_index.import
53
53
 
54
- expect(Chewy::Stash.exists?).to eq true
54
+ expect(Chewy::Stash::Journal.exists?).to eq true
55
55
 
56
56
  Timecop.freeze(update_time)
57
57
  cities.first.update_attributes!(name: 'Supername')
@@ -65,63 +65,63 @@ describe Chewy::Journal do
65
65
  'index_name' => "#{namespace}places",
66
66
  'type_name' => 'city',
67
67
  'action' => 'index',
68
- 'references' => ['1'],
68
+ 'references' => ['1'].map(&Base64.method(:encode64)),
69
69
  'created_at' => time.utc.as_json
70
70
  },
71
71
  {
72
72
  'index_name' => "#{namespace}places",
73
73
  'type_name' => 'city',
74
74
  'action' => 'index',
75
- 'references' => ['2'],
75
+ 'references' => ['2'].map(&Base64.method(:encode64)),
76
76
  'created_at' => time.utc.as_json
77
77
  },
78
78
  {
79
79
  'index_name' => "#{namespace}places",
80
80
  'type_name' => 'country',
81
81
  'action' => 'index',
82
- 'references' => ['1'],
82
+ 'references' => ['1'].map(&Base64.method(:encode64)),
83
83
  'created_at' => time.utc.as_json
84
84
  },
85
85
  {
86
86
  'index_name' => "#{namespace}places",
87
87
  'type_name' => 'country',
88
88
  'action' => 'index',
89
- 'references' => ['2'],
89
+ 'references' => ['2'].map(&Base64.method(:encode64)),
90
90
  'created_at' => time.utc.as_json
91
91
  },
92
92
  {
93
93
  'index_name' => "#{namespace}places",
94
94
  'type_name' => 'country',
95
95
  'action' => 'index',
96
- 'references' => ['3'],
96
+ 'references' => ['3'].map(&Base64.method(:encode64)),
97
97
  'created_at' => time.utc.as_json
98
98
  },
99
99
  {
100
100
  'index_name' => "#{namespace}places",
101
101
  'type_name' => 'city',
102
102
  'action' => 'index',
103
- 'references' => %w[1 2],
103
+ 'references' => %w[1 2].map(&Base64.method(:encode64)),
104
104
  'created_at' => import_time.utc.as_json
105
105
  },
106
106
  {
107
107
  'index_name' => "#{namespace}places",
108
108
  'type_name' => 'country',
109
109
  'action' => 'index',
110
- 'references' => %w[1 2 3],
110
+ 'references' => %w[1 2 3].map(&Base64.method(:encode64)),
111
111
  'created_at' => import_time.utc.as_json
112
112
  },
113
113
  {
114
114
  'index_name' => "#{namespace}places",
115
115
  'type_name' => 'city',
116
116
  'action' => 'index',
117
- 'references' => ['1'],
117
+ 'references' => ['1'].map(&Base64.method(:encode64)),
118
118
  'created_at' => update_time.utc.as_json
119
119
  },
120
120
  {
121
121
  'index_name' => "#{namespace}places",
122
122
  'type_name' => 'country',
123
123
  'action' => 'delete',
124
- 'references' => ['2'],
124
+ 'references' => ['2'].map(&Base64.method(:encode64)),
125
125
  'created_at' => destroy_time.utc.as_json
126
126
  }
127
127
  ]
@@ -231,7 +231,7 @@ describe Chewy::Journal do
231
231
  let!(:journal_entries) do
232
232
  record = Chewy::Stash::Journal.entries(time).first
233
233
  Array.new(count_of_checks) do |i|
234
- Chewy::Stash::Journal.new(
234
+ Chewy::Stash::Journal::Journal.new(
235
235
  record.attributes.merge(
236
236
  'created_at' => time.to_i + i,
237
237
  'references' => [i.to_s]
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Chewy::Query::Filters do
4
- def Bool(options) # rubocop:disable Style/MethodName
4
+ def Bool(options) # rubocop:disable Naming/MethodName
5
5
  Chewy::Query::Nodes::Bool.new.tap do |bool|
6
6
  bool.must(*options[:must]) if options[:must].present?
7
7
  bool.must_not(*options[:must_not]) if options[:must_not].present?
@@ -9,5 +9,6 @@ describe Chewy::Query::Nodes::Not do
9
9
  # rubocop:disable Style/InverseMethods
10
10
  specify { expect(render { !(email == 'email') }).to eq(not: {term: {'email' => 'email'}}) }
11
11
  specify { expect(render { ~!(email == 'email') }).to eq(not: {filter: {term: {'email' => 'email'}}, _cache: true}) }
12
+ # rubocop:enable Style/InverseMethods
12
13
  end
13
14
  end
@@ -36,6 +36,7 @@ describe Chewy::Query do
36
36
  specify { expect(subject.offset(6).count).to eq(3) }
37
37
  specify { expect(subject.query(match: {name: 'name3'}).highlight(fields: {name: {}}).first.name).to eq('Name3') }
38
38
  specify { expect(subject.query(match: {name: 'name3'}).highlight(fields: {name: {}}).first.name_highlight).to eq('<em>Name3</em>') }
39
+ specify { expect(subject.query({}).highlight(fields: {name: {}}).first.name_highlight).to eq(nil) }
39
40
  specify { expect(subject.query(match: {name: 'name3'}).highlight(fields: {name: {}}).first._data['_source']['name']).to eq('Name3') }
40
41
  specify { expect(subject.types(:product).count).to eq(3) }
41
42
  specify { expect(subject.types(:product, :country).count).to eq(6) }
@@ -216,7 +217,7 @@ describe Chewy::Query do
216
217
  define_type :product do
217
218
  root do
218
219
  field :name, 'surname'
219
- field :title, type: 'string' do
220
+ field :title do
220
221
  field :subfield1
221
222
  end
222
223
  field 'price', type: 'float' do
@@ -237,7 +238,7 @@ describe Chewy::Query do
237
238
  define_type :product do
238
239
  root do
239
240
  field :name, 'surname'
240
- field :title, type: 'string' do
241
+ field :title do
241
242
  field :subfield1
242
243
  end
243
244
  field 'price', type: 'float' do
@@ -23,8 +23,21 @@ describe Chewy::RakeHelper, :orm do
23
23
  let!(:countries) { Array.new(2) { |i| Country.create!(name: "Name#{i + 1}") } }
24
24
  let(:journal) do
25
25
  Chewy::Stash::Journal.import([
26
- {index_name: 'places', type_name: 'city', action: 'index', references: cities.first(2).map(&:id).map(&:to_s).map(&:to_json), created_at: 2.minutes.since},
27
- {index_name: 'places', type_name: 'country', action: 'index', references: [countries.first.id.to_s.to_json], created_at: 4.minutes.since}
26
+ {
27
+ index_name: 'places',
28
+ type_name: 'city',
29
+ action: 'index',
30
+ references: cities.first(2).map(&:id).map(&:to_s)
31
+ .map(&:to_json).map(&Base64.method(:encode64)),
32
+ created_at: 2.minutes.since
33
+ },
34
+ {
35
+ index_name: 'places',
36
+ type_name: 'country',
37
+ action: 'index',
38
+ references: [Base64.encode64(countries.first.id.to_s.to_json)],
39
+ created_at: 4.minutes.since
40
+ }
28
41
  ])
29
42
  end
30
43
 
@@ -37,14 +50,14 @@ describe Chewy::RakeHelper, :orm do
37
50
  .to update_index(PlacesIndex::City)
38
51
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
39
52
  \\AResetting PlacesIndex
40
- Imported PlacesIndex::City for \\d+s, stats: index 3
41
- Imported PlacesIndex::Country for \\d+s, stats: index 2
53
+ Imported PlacesIndex::City in \\d+s, stats: index 3
54
+ Imported PlacesIndex::Country in \\d+s, stats: index 2
42
55
  Applying journal to \\[PlacesIndex::City, PlacesIndex::Country\\], 3 entries, stage 1
43
- Imported PlacesIndex::City for \\d+s, stats: index 2
44
- Imported PlacesIndex::Country for \\d+s, stats: index 1
45
- Imported Chewy::Stash::Specification for \\d+s, stats: index 1
56
+ Imported PlacesIndex::City in \\d+s, stats: index 2
57
+ Imported PlacesIndex::Country in \\d+s, stats: index 1
58
+ Imported Chewy::Stash::Specification::Specification in \\d+s, stats: index 1
46
59
  Resetting UsersIndex
47
- Imported Chewy::Stash::Specification for \\d+s, stats: index 1
60
+ Imported Chewy::Stash::Specification::Specification in \\d+s, stats: index 1
48
61
  Total: \\d+s\\Z
49
62
  OUTPUT
50
63
  end
@@ -55,12 +68,12 @@ Total: \\d+s\\Z
55
68
  .to update_index(PlacesIndex::City)
56
69
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
57
70
  \\AResetting PlacesIndex
58
- Imported PlacesIndex::City for \\d+s, stats: index 3
59
- Imported PlacesIndex::Country for \\d+s, stats: index 2
71
+ Imported PlacesIndex::City in \\d+s, stats: index 3
72
+ Imported PlacesIndex::Country in \\d+s, stats: index 2
60
73
  Applying journal to \\[PlacesIndex::City, PlacesIndex::Country\\], 3 entries, stage 1
61
- Imported PlacesIndex::City for \\d+s, stats: index 2
62
- Imported PlacesIndex::Country for \\d+s, stats: index 1
63
- Imported Chewy::Stash::Specification for \\d+s, stats: index 1
74
+ Imported PlacesIndex::City in \\d+s, stats: index 2
75
+ Imported PlacesIndex::Country in \\d+s, stats: index 1
76
+ Imported Chewy::Stash::Specification::Specification in \\d+s, stats: index 1
64
77
  Total: \\d+s\\Z
65
78
  OUTPUT
66
79
  end
@@ -71,7 +84,7 @@ Total: \\d+s\\Z
71
84
  .not_to update_index(PlacesIndex::City)
72
85
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
73
86
  \\AResetting UsersIndex
74
- Imported Chewy::Stash::Specification for \\d+s, stats: index 1
87
+ Imported Chewy::Stash::Specification::Specification in \\d+s, stats: index 1
75
88
  Total: \\d+s\\Z
76
89
  OUTPUT
77
90
  end
@@ -84,11 +97,11 @@ Total: \\d+s\\Z
84
97
  .to update_index(PlacesIndex::City)
85
98
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
86
99
  \\AResetting PlacesIndex
87
- Imported PlacesIndex::City for \\d+s, stats: index 3
88
- Imported PlacesIndex::Country for \\d+s, stats: index 2
89
- Imported Chewy::Stash::Specification for \\d+s, stats: index 1
100
+ Imported PlacesIndex::City in \\d+s, stats: index 3
101
+ Imported PlacesIndex::Country in \\d+s, stats: index 2
102
+ Imported Chewy::Stash::Specification::Specification in \\d+s, stats: index 1
90
103
  Resetting UsersIndex
91
- Imported Chewy::Stash::Specification for \\d+s, stats: index 1
104
+ Imported Chewy::Stash::Specification::Specification in \\d+s, stats: index 1
92
105
  Total: \\d+s\\Z
93
106
  OUTPUT
94
107
  end
@@ -103,7 +116,7 @@ Total: \\d+s\\Z
103
116
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
104
117
  \\ASkipping PlacesIndex, the specification didn't change
105
118
  Resetting UsersIndex
106
- Imported Chewy::Stash::Specification for \\d+s, stats: index 1
119
+ Imported Chewy::Stash::Specification::Specification in \\d+s, stats: index 1
107
120
  Total: \\d+s\\Z
108
121
  OUTPUT
109
122
  end
@@ -114,7 +127,7 @@ Total: \\d+s\\Z
114
127
  .not_to update_index(PlacesIndex::City)
115
128
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
116
129
  \\AResetting UsersIndex
117
- Imported Chewy::Stash::Specification for \\d+s, stats: index 1
130
+ Imported Chewy::Stash::Specification::Specification in \\d+s, stats: index 1
118
131
  Total: \\d+s\\Z
119
132
  OUTPUT
120
133
  end
@@ -154,8 +167,8 @@ Total: \\d+s\\Z
154
167
  .to update_index(PlacesIndex::City)
155
168
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
156
169
  \\AUpdating PlacesIndex
157
- Imported PlacesIndex::City for \\d+s, stats: index 3
158
- Imported PlacesIndex::Country for \\d+s, stats: index 2
170
+ Imported PlacesIndex::City in \\d+s, stats: index 3
171
+ Imported PlacesIndex::Country in \\d+s, stats: index 2
159
172
  Total: \\d+s\\Z
160
173
  OUTPUT
161
174
  end
@@ -166,7 +179,7 @@ Total: \\d+s\\Z
166
179
  .not_to update_index(PlacesIndex::City)
167
180
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
168
181
  \\AUpdating PlacesIndex
169
- Imported PlacesIndex::Country for \\d+s, stats: index 2
182
+ Imported PlacesIndex::Country in \\d+s, stats: index 2
170
183
  Total: \\d+s\\Z
171
184
  OUTPUT
172
185
  end
@@ -177,7 +190,7 @@ Total: \\d+s\\Z
177
190
  .to update_index(PlacesIndex::City)
178
191
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
179
192
  \\AUpdating PlacesIndex
180
- Imported PlacesIndex::City for \\d+s, stats: index 3
193
+ Imported PlacesIndex::City in \\d+s, stats: index 3
181
194
  Total: \\d+s\\Z
182
195
  OUTPUT
183
196
  end
@@ -191,12 +204,12 @@ Total: \\d+s\\Z
191
204
  .to update_index(PlacesIndex::City)
192
205
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
193
206
  \\ASynchronizing PlacesIndex::City
194
- Imported PlacesIndex::City for \\d+s, stats: index 3
207
+ Imported PlacesIndex::City in \\d+s, stats: index 3
195
208
  Missing documents: \\[[^\\]]+\\]
196
209
  Took \\d+s
197
210
  Synchronizing PlacesIndex::Country
198
211
  PlacesIndex::Country doesn't support outdated synchronization
199
- Imported PlacesIndex::Country for \\d+s, stats: index 2
212
+ Imported PlacesIndex::Country in \\d+s, stats: index 2
200
213
  Missing documents: \\[[^\\]]+\\]
201
214
  Took \\d+s
202
215
  Total: \\d+s\\Z
@@ -218,7 +231,7 @@ Total: \\d+s\\Z
218
231
  .to update_index(PlacesIndex::City)
219
232
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
220
233
  \\ASynchronizing PlacesIndex::City
221
- Imported PlacesIndex::City for \\d+s, stats: index 2
234
+ Imported PlacesIndex::City in \\d+s, stats: index 2
222
235
  Missing documents: \\["#{cities.last.id}"\\]
223
236
  Outdated documents: \\["#{cities.first.id}"\\]
224
237
  Took \\d+s
@@ -236,7 +249,7 @@ Total: \\d+s\\Z
236
249
  .to update_index(PlacesIndex::City)
237
250
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
238
251
  \\ASynchronizing PlacesIndex::City
239
- Imported PlacesIndex::City for \\d+s, stats: index 2
252
+ Imported PlacesIndex::City in \\d+s, stats: index 2
240
253
  Missing documents: \\["#{cities.last.id}"\\]
241
254
  Outdated documents: \\["#{cities.first.id}"\\]
242
255
  Took \\d+s
@@ -281,8 +294,8 @@ Total: \\d+s\\Z
281
294
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
282
295
  \\AApplying journal entries created after [+-:\\d\\s]+
283
296
  Applying journal to \\[PlacesIndex::City, PlacesIndex::Country\\], 3 entries, stage 1
284
- Imported PlacesIndex::City for \\d+s, stats: index 2
285
- Imported PlacesIndex::Country for \\d+s, stats: index 1
297
+ Imported PlacesIndex::City in \\d+s, stats: index 2
298
+ Imported PlacesIndex::Country in \\d+s, stats: index 1
286
299
  Total: \\d+s\\Z
287
300
  OUTPUT
288
301
  end
@@ -294,7 +307,7 @@ Total: \\d+s\\Z
294
307
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
295
308
  \\AApplying journal entries created after [+-:\\d\\s]+
296
309
  Applying journal to \\[PlacesIndex::Country\\], 1 entries, stage 1
297
- Imported PlacesIndex::Country for \\d+s, stats: index 1
310
+ Imported PlacesIndex::Country in \\d+s, stats: index 1
298
311
  Total: \\d+s\\Z
299
312
  OUTPUT
300
313
  end
@@ -306,7 +319,7 @@ Total: \\d+s\\Z
306
319
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
307
320
  \\AApplying journal entries created after [+-:\\d\\s]+
308
321
  Applying journal to \\[PlacesIndex::City\\], 2 entries, stage 1
309
- Imported PlacesIndex::City for \\d+s, stats: index 2
322
+ Imported PlacesIndex::City in \\d+s, stats: index 2
310
323
  Total: \\d+s\\Z
311
324
  OUTPUT
312
325
  end
@@ -318,7 +331,7 @@ Total: \\d+s\\Z
318
331
  expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
319
332
  \\AApplying journal entries created after [+-:\\d\\s]+
320
333
  Applying journal to \\[PlacesIndex::Country\\], 1 entries, stage 1
321
- Imported PlacesIndex::Country for \\d+s, stats: index 1
334
+ Imported PlacesIndex::Country in \\d+s, stats: index 1
322
335
  Total: \\d+s\\Z
323
336
  OUTPUT
324
337
  end