chewy 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -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
@@ -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.2
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-10-24 00:00:00.000000000 Z
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.23.gemfile
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