chewy 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Appraisals +2 -2
- data/CHANGELOG.md +22 -0
- data/gemfiles/{sequel.4.23.gemfile → sequel.4.28.gemfile} +1 -1
- data/lib/chewy.rb +0 -14
- data/lib/chewy/railtie.rb +1 -1
- data/lib/chewy/rspec/update_index.rb +1 -1
- data/lib/chewy/strategy/atomic.rb +1 -1
- data/lib/chewy/type/adapter/active_record.rb +4 -8
- data/lib/chewy/type/adapter/base.rb +1 -6
- data/lib/chewy/type/adapter/mongoid.rb +1 -1
- data/lib/chewy/type/adapter/orm.rb +21 -9
- data/lib/chewy/type/adapter/sequel.rb +38 -86
- data/lib/chewy/type/import.rb +11 -11
- data/lib/chewy/type/mapping.rb +4 -5
- data/lib/chewy/version.rb +1 -1
- data/lib/sequel/plugins/chewy_observe.rb +8 -1
- data/spec/chewy/query/criteria_spec.rb +4 -4
- data/spec/chewy/strategy/atomic_spec.rb +59 -0
- data/spec/chewy/type/adapter/active_record_spec.rb +19 -43
- data/spec/chewy/type/adapter/mongoid_spec.rb +17 -41
- data/spec/chewy/type/adapter/object_spec.rb +0 -13
- data/spec/chewy/type/adapter/sequel_spec.rb +295 -21
- data/spec/chewy/type/import_spec.rb +11 -0
- data/spec/chewy_spec.rb +0 -15
- data/spec/support/class_helpers.rb +4 -0
- data/spec/support/sequel.rb +7 -1
- metadata +5 -3
@@ -349,5 +349,16 @@ describe Chewy::Type::Import do
|
|
349
349
|
|
350
350
|
specify { expect { city.import!(dummy_cities) }.to raise_error Chewy::ImportFailed }
|
351
351
|
end
|
352
|
+
|
353
|
+
context 'when .import fails' do
|
354
|
+
before do
|
355
|
+
allow(city).to receive(:import) { raise }
|
356
|
+
end
|
357
|
+
|
358
|
+
specify do
|
359
|
+
expect(ActiveSupport::Notifications).to receive(:unsubscribe)
|
360
|
+
city.import!(dummy_cities) rescue nil
|
361
|
+
end
|
362
|
+
end
|
352
363
|
end
|
353
364
|
end
|
data/spec/chewy_spec.rb
CHANGED
@@ -110,19 +110,4 @@ describe Chewy do
|
|
110
110
|
specify { expect(DevelopersIndex.exists?).to eq(false) }
|
111
111
|
specify { expect(CompaniesIndex.exists?).to eq(false) }
|
112
112
|
end
|
113
|
-
|
114
|
-
describe '#urgent_update=' do
|
115
|
-
specify do
|
116
|
-
described_class.urgent_update = true
|
117
|
-
expect(described_class.strategy.current).to be_a(Chewy::Strategy::Urgent)
|
118
|
-
described_class.urgent_update = false
|
119
|
-
expect(described_class.strategy.current).to be_a(Chewy::Strategy::Base)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
describe '#atomic' do
|
124
|
-
specify do
|
125
|
-
described_class.atomic { expect(described_class.strategy.current).to be_a(Chewy::Strategy::Atomic) }
|
126
|
-
end
|
127
|
-
end
|
128
113
|
end
|
@@ -9,4 +9,8 @@ module ClassHelpers
|
|
9
9
|
def stub_class name, superclass = nil, &block
|
10
10
|
stub_const(name.to_s.camelize, Class.new(superclass || Object, &block))
|
11
11
|
end
|
12
|
+
|
13
|
+
def stub_model name, superclass = nil, &block
|
14
|
+
raise NotImplementedError, 'Seems like no ORM/ODM are loaded, please check your Gemfile'
|
15
|
+
end
|
12
16
|
end
|
data/spec/support/sequel.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'database_cleaner'
|
2
2
|
|
3
|
-
DB = Sequel.sqlite
|
3
|
+
DB = Sequel.sqlite# logger: Logger.new(STDOUT)
|
4
4
|
|
5
5
|
DB.create_table :countries do
|
6
6
|
primary_key :id
|
@@ -16,6 +16,12 @@ DB.create_table :cities do
|
|
16
16
|
column :rating, :integer
|
17
17
|
end
|
18
18
|
|
19
|
+
DB.create_table :rating_cities do
|
20
|
+
primary_key :rating
|
21
|
+
column :country_id, :integer
|
22
|
+
column :name, :string
|
23
|
+
end
|
24
|
+
|
19
25
|
Sequel::Model.plugin :chewy_observe
|
20
26
|
|
21
27
|
module SequelClassHelpers
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chewy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pyromaniac
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -205,7 +205,7 @@ files:
|
|
205
205
|
- gemfiles/rails.4.2.mongoid.gemfile
|
206
206
|
- gemfiles/rails.4.2.mongoid.kaminari.gemfile
|
207
207
|
- gemfiles/rails.4.2.mongoid.will_paginate.gemfile
|
208
|
-
- gemfiles/sequel.4.
|
208
|
+
- gemfiles/sequel.4.28.gemfile
|
209
209
|
- lib/chewy.rb
|
210
210
|
- lib/chewy/backports/deep_dup.rb
|
211
211
|
- lib/chewy/backports/duplicable.rb
|
@@ -318,6 +318,7 @@ files:
|
|
318
318
|
- spec/chewy/runtime_spec.rb
|
319
319
|
- spec/chewy/search_spec.rb
|
320
320
|
- spec/chewy/strategy/active_job_spec.rb
|
321
|
+
- spec/chewy/strategy/atomic_spec.rb
|
321
322
|
- spec/chewy/strategy/resque_spec.rb
|
322
323
|
- spec/chewy/strategy/sidekiq_spec.rb
|
323
324
|
- spec/chewy/strategy_spec.rb
|
@@ -400,6 +401,7 @@ test_files:
|
|
400
401
|
- spec/chewy/runtime_spec.rb
|
401
402
|
- spec/chewy/search_spec.rb
|
402
403
|
- spec/chewy/strategy/active_job_spec.rb
|
404
|
+
- spec/chewy/strategy/atomic_spec.rb
|
403
405
|
- spec/chewy/strategy/resque_spec.rb
|
404
406
|
- spec/chewy/strategy/sidekiq_spec.rb
|
405
407
|
- spec/chewy/strategy_spec.rb
|