global-registry-bindings 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe GlobalRegistry::Bindings::Testing do
6
+ describe 'skip_workers! &block' do
7
+ around(:example) do |example|
8
+ GlobalRegistry::Bindings::Testing.skip_workers!(&example)
9
+ end
10
+
11
+ it 'should not enqueue sidekiq jobs' do
12
+ person = build(:person)
13
+ expect do
14
+ person.save
15
+ end.to change(Sidekiq::Worker.jobs, :size).by(0)
16
+ end
17
+
18
+ context 'disable_test_helper! &block' do
19
+ it 'should enqueue sidekiq jobs' do
20
+ expect(GlobalRegistry::Bindings::Testing.enabled?).to be true
21
+ GlobalRegistry::Bindings::Testing.disable_test_helper! do
22
+ expect(GlobalRegistry::Bindings::Testing.enabled?).to be false
23
+ expect(GlobalRegistry::Bindings::Testing.disabled?).to be true
24
+ person = build(:person)
25
+ expect do
26
+ person.save
27
+ end.to change(GlobalRegistry::Bindings::Workers::PushEntityWorker.jobs, :size).by(1).and(
28
+ change(GlobalRegistry::Bindings::Workers::PullNamespacedPersonMdmIdWorker.jobs, :size).by(1).and(
29
+ change(GlobalRegistry::Bindings::Workers::PushRelationshipWorker.jobs, :size).by(0).and(
30
+ change(GlobalRegistry::Bindings::Workers::DeleteEntityWorker.jobs, :size).by(0)
31
+ )
32
+ )
33
+ )
34
+ end
35
+ expect(GlobalRegistry::Bindings::Testing.enabled?).to be true
36
+ end
37
+ end
38
+ end
39
+
40
+ describe 'skip_workers! enable/disable' do
41
+ before do
42
+ GlobalRegistry::Bindings::Testing.skip_workers!
43
+ end
44
+ after do
45
+ GlobalRegistry::Bindings::Testing.disable_test_helper!
46
+ end
47
+
48
+ it 'should not enqueue sidekiq jobs' do
49
+ person = build(:person)
50
+ expect do
51
+ person.save
52
+ end.to change(Sidekiq::Worker.jobs, :size).by(0)
53
+ end
54
+ end
55
+ end
@@ -16,6 +16,7 @@ require 'factory_girl'
16
16
  require 'simplecov'
17
17
 
18
18
  require 'global_registry_bindings'
19
+ require 'global_registry_bindings/testing'
19
20
 
20
21
  require 'sidekiq/testing'
21
22
  require 'sidekiq_unique_jobs/testing'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: global-registry-bindings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Zoetewey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-02 00:00:00.000000000 Z
11
+ date: 2017-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -332,6 +332,7 @@ files:
332
332
  - lib/global_registry_bindings/options/relationship_instance_options.rb
333
333
  - lib/global_registry_bindings/options/relationship_options_parser.rb
334
334
  - lib/global_registry_bindings/railtie.rb
335
+ - lib/global_registry_bindings/testing.rb
335
336
  - lib/global_registry_bindings/version.rb
336
337
  - lib/global_registry_bindings/worker.rb
337
338
  - lib/global_registry_bindings/workers/delete_entity_worker.rb
@@ -399,6 +400,7 @@ files:
399
400
  - spec/models/assignment_spec.rb
400
401
  - spec/models/organization_spec.rb
401
402
  - spec/models/person_spec.rb
403
+ - spec/models/testing_spec.rb
402
404
  - spec/models/user_edited_person_spec.rb
403
405
  - spec/spec_helper.rb
404
406
  - spec/workers/delete_gr_entity_worker_spec.rb
@@ -491,6 +493,7 @@ test_files:
491
493
  - spec/models/assignment_spec.rb
492
494
  - spec/models/organization_spec.rb
493
495
  - spec/models/person_spec.rb
496
+ - spec/models/testing_spec.rb
494
497
  - spec/models/user_edited_person_spec.rb
495
498
  - spec/spec_helper.rb
496
499
  - spec/workers/delete_gr_entity_worker_spec.rb