maestrano-connector-rails 2.0.2.pre.RC6 → 2.0.2.pre.RC7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +6 -0
- data/DEVELOPER.md +1 -4
- data/Gemfile +2 -32
- data/Rakefile +6 -30
- data/app/models/maestrano/connector/rails/concerns/entity.rb +12 -0
- data/app/models/maestrano/connector/rails/concerns/sub_entity_base.rb +3 -2
- data/app/models/maestrano/connector/rails/id_map.rb +1 -0
- data/app/models/maestrano/connector/rails/services/data_consolidator.rb +4 -4
- data/db/migrate/20170315032224_add_metadata_to_id_map.rb +5 -0
- data/lib/maestrano/connector/rails/version.rb +7 -0
- data/lib/maestrano_connector_rails/factories.rb +1 -0
- data/maestrano-connector-rails.gemspec +44 -308
- metadata +13 -151
- data/VERSION +0 -1
- data/spec/controllers/connec_controller_spec.rb +0 -179
- data/spec/controllers/dependancies_controller_spec.rb +0 -31
- data/spec/controllers/group_users_controller_spec.rb +0 -39
- data/spec/controllers/groups_controller_spec.rb +0 -36
- data/spec/controllers/synchronizations_controller_spec.rb +0 -211
- data/spec/controllers/version_controller_spec.rb +0 -17
- data/spec/dummy/README.md +0 -1
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/controllers/application_controller.rb +0 -8
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/entities/.keep +0 -0
- data/spec/dummy/app/views/home/index.html.erb +0 -1
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/bin/setup +0 -29
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/application.rb +0 -26
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -41
- data/spec/dummy/config/environments/production.rb +0 -79
- data/spec/dummy/config/environments/test.rb +0 -39
- data/spec/dummy/config/initializers/assets.rb +0 -11
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/maestrano.rb +0 -2
- data/spec/dummy/config/initializers/mime_types.rb +0 -4
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -23
- data/spec/dummy/config/routes.rb +0 -9
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/config/settings.yml +0 -2
- data/spec/dummy/config/settings/development.yml +0 -12
- data/spec/dummy/config/settings/production.yml +0 -1
- data/spec/dummy/config/settings/test.yml +0 -12
- data/spec/dummy/config/settings/uat.yml +0 -1
- data/spec/dummy/db/schema.rb +0 -102
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +0 -67
- data/spec/dummy/public/422.html +0 -67
- data/spec/dummy/public/500.html +0 -66
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/cache/.gitkeep +0 -0
- data/spec/integration/complex_id_references_spec.rb +0 -249
- data/spec/integration/complex_naming_spec.rb +0 -192
- data/spec/integration/complex_spec.rb +0 -578
- data/spec/integration/connec_to_external_spec.rb +0 -327
- data/spec/integration/external_to_connec_spec.rb +0 -159
- data/spec/integration/id_references_spec.rb +0 -584
- data/spec/integration/singleton_spec.rb +0 -297
- data/spec/jobs/all_synchronizations_job_spec.rb +0 -24
- data/spec/jobs/push_to_connec_job_spec.rb +0 -111
- data/spec/jobs/push_to_connec_worker_spec.rb +0 -37
- data/spec/jobs/synchronization_job_spec.rb +0 -216
- data/spec/models/complex_entity_spec.rb +0 -407
- data/spec/models/connec_helper_spec.rb +0 -588
- data/spec/models/connector_logger_spec.rb +0 -26
- data/spec/models/entity_base_spec.rb +0 -20
- data/spec/models/entity_spec.rb +0 -1078
- data/spec/models/external_spec.rb +0 -27
- data/spec/models/id_map_spec.rb +0 -12
- data/spec/models/organization_spec.rb +0 -243
- data/spec/models/sub_entity_base_spec.rb +0 -155
- data/spec/models/synchronization_spec.rb +0 -106
- data/spec/models/user_organization_rel_spec.rb +0 -14
- data/spec/models/user_spec.rb +0 -15
- data/spec/routing/connec_routing_spec.rb +0 -12
- data/spec/spec_helper.rb +0 -34
- data/template/Procfile +0 -2
- data/template/application-sample.yml +0 -13
- data/template/database.yml +0 -31
- data/template/gitignore +0 -23
- data/template/maestrano.rb +0 -2
- data/template/maestrano_connector_template.rb +0 -135
- data/template/routes.rb +0 -25
- data/template/rubocop.yml +0 -55
- data/template/settings/development.yml +0 -0
- data/template/settings/production.yml +0 -0
- data/template/settings/settings.yml +0 -2
- data/template/settings/test.yml +0 -0
- data/template/settings/uat.yml +0 -0
- data/template/sidekiq.rb +0 -9
- data/template/sidekiq.yml +0 -4
- data/template/spec_helper.rb +0 -24
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maestrano-connector-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.2.pre.
|
4
|
+
version: 2.0.2.pre.RC7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maestrano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.2.7.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.2.7.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: maestrano-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,16 +140,16 @@ dependencies:
|
|
140
140
|
name: sidekiq
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: 4.2.9
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: 4.2.9
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: sidekiq-cron
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,20 +206,6 @@ dependencies:
|
|
206
206
|
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
|
-
- !ruby/object:Gem::Dependency
|
210
|
-
name: activerecord-jdbcsqlite3-adapter
|
211
|
-
requirement: !ruby/object:Gem::Requirement
|
212
|
-
requirements:
|
213
|
-
- - ">="
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '0'
|
216
|
-
type: :development
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
requirements:
|
220
|
-
- - ">="
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '0'
|
223
209
|
- !ruby/object:Gem::Dependency
|
224
210
|
name: bundler
|
225
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,20 +248,6 @@ dependencies:
|
|
262
248
|
- - ">="
|
263
249
|
- !ruby/object:Gem::Version
|
264
250
|
version: '0'
|
265
|
-
- !ruby/object:Gem::Dependency
|
266
|
-
name: jeweler
|
267
|
-
requirement: !ruby/object:Gem::Requirement
|
268
|
-
requirements:
|
269
|
-
- - ">="
|
270
|
-
- !ruby/object:Gem::Version
|
271
|
-
version: '0'
|
272
|
-
type: :development
|
273
|
-
prerelease: false
|
274
|
-
version_requirements: !ruby/object:Gem::Requirement
|
275
|
-
requirements:
|
276
|
-
- - ">="
|
277
|
-
- !ruby/object:Gem::Version
|
278
|
-
version: '0'
|
279
251
|
- !ruby/object:Gem::Dependency
|
280
252
|
name: rdoc
|
281
253
|
requirement: !ruby/object:Gem::Requirement
|
@@ -360,20 +332,6 @@ dependencies:
|
|
360
332
|
- - ">="
|
361
333
|
- !ruby/object:Gem::Version
|
362
334
|
version: '0'
|
363
|
-
- !ruby/object:Gem::Dependency
|
364
|
-
name: sqlite3
|
365
|
-
requirement: !ruby/object:Gem::Requirement
|
366
|
-
requirements:
|
367
|
-
- - ">="
|
368
|
-
- !ruby/object:Gem::Version
|
369
|
-
version: '0'
|
370
|
-
type: :development
|
371
|
-
prerelease: false
|
372
|
-
version_requirements: !ruby/object:Gem::Requirement
|
373
|
-
requirements:
|
374
|
-
- - ">="
|
375
|
-
- !ruby/object:Gem::Version
|
376
|
-
version: '0'
|
377
335
|
- !ruby/object:Gem::Dependency
|
378
336
|
name: timecop
|
379
337
|
requirement: !ruby/object:Gem::Requirement
|
@@ -411,6 +369,7 @@ extra_rdoc_files:
|
|
411
369
|
- LICENSE
|
412
370
|
- README.md
|
413
371
|
files:
|
372
|
+
- ".gitignore"
|
414
373
|
- ".rspec"
|
415
374
|
- ".rubocop.yml"
|
416
375
|
- ".rubocop_todo.yml"
|
@@ -422,7 +381,6 @@ files:
|
|
422
381
|
- LICENSE
|
423
382
|
- README.md
|
424
383
|
- Rakefile
|
425
|
-
- VERSION
|
426
384
|
- app/controllers/maestrano/account/group_users_controller.rb
|
427
385
|
- app/controllers/maestrano/account/groups_controller.rb
|
428
386
|
- app/controllers/maestrano/application_controller.rb
|
@@ -474,6 +432,7 @@ files:
|
|
474
432
|
- db/migrate/20161011005751_add_unique_index_on_organization_oauth_uid.rb
|
475
433
|
- db/migrate/20161018155513_add_org_uid_to_organization.rb
|
476
434
|
- db/migrate/20170202033323_update_organization_metadata.rb
|
435
|
+
- db/migrate/20170315032224_add_metadata_to_id_map.rb
|
477
436
|
- lib/generators/connector/USAGE
|
478
437
|
- lib/generators/connector/complex_entity_generator.rb
|
479
438
|
- lib/generators/connector/install_generator.rb
|
@@ -505,110 +464,13 @@ files:
|
|
505
464
|
- lib/generators/connector/templates/synchronizations_controller_spec.rb
|
506
465
|
- lib/generators/connector/templates/synchronizations_index.haml
|
507
466
|
- lib/maestrano/connector/rails.rb
|
467
|
+
- lib/maestrano/connector/rails/version.rb
|
508
468
|
- lib/maestrano_connector_rails.rb
|
509
469
|
- lib/maestrano_connector_rails/factories.rb
|
510
470
|
- maestrano-connector-rails.gemspec
|
511
471
|
- maestrano.png
|
512
472
|
- release_notes.md
|
513
|
-
|
514
|
-
- spec/controllers/dependancies_controller_spec.rb
|
515
|
-
- spec/controllers/group_users_controller_spec.rb
|
516
|
-
- spec/controllers/groups_controller_spec.rb
|
517
|
-
- spec/controllers/synchronizations_controller_spec.rb
|
518
|
-
- spec/controllers/version_controller_spec.rb
|
519
|
-
- spec/dummy/README.md
|
520
|
-
- spec/dummy/Rakefile
|
521
|
-
- spec/dummy/app/assets/images/.keep
|
522
|
-
- spec/dummy/app/assets/javascripts/application.js
|
523
|
-
- spec/dummy/app/assets/stylesheets/application.css
|
524
|
-
- spec/dummy/app/controllers/application_controller.rb
|
525
|
-
- spec/dummy/app/controllers/concerns/.keep
|
526
|
-
- spec/dummy/app/helpers/application_helper.rb
|
527
|
-
- spec/dummy/app/mailers/.keep
|
528
|
-
- spec/dummy/app/models/.keep
|
529
|
-
- spec/dummy/app/models/concerns/.keep
|
530
|
-
- spec/dummy/app/models/entities/.keep
|
531
|
-
- spec/dummy/app/views/home/index.html.erb
|
532
|
-
- spec/dummy/app/views/layouts/application.html.erb
|
533
|
-
- spec/dummy/bin/bundle
|
534
|
-
- spec/dummy/bin/rails
|
535
|
-
- spec/dummy/bin/rake
|
536
|
-
- spec/dummy/bin/setup
|
537
|
-
- spec/dummy/config.ru
|
538
|
-
- spec/dummy/config/application.rb
|
539
|
-
- spec/dummy/config/boot.rb
|
540
|
-
- spec/dummy/config/database.yml
|
541
|
-
- spec/dummy/config/environment.rb
|
542
|
-
- spec/dummy/config/environments/development.rb
|
543
|
-
- spec/dummy/config/environments/production.rb
|
544
|
-
- spec/dummy/config/environments/test.rb
|
545
|
-
- spec/dummy/config/initializers/assets.rb
|
546
|
-
- spec/dummy/config/initializers/backtrace_silencers.rb
|
547
|
-
- spec/dummy/config/initializers/cookies_serializer.rb
|
548
|
-
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
549
|
-
- spec/dummy/config/initializers/inflections.rb
|
550
|
-
- spec/dummy/config/initializers/maestrano.rb
|
551
|
-
- spec/dummy/config/initializers/mime_types.rb
|
552
|
-
- spec/dummy/config/initializers/session_store.rb
|
553
|
-
- spec/dummy/config/initializers/wrap_parameters.rb
|
554
|
-
- spec/dummy/config/locales/en.yml
|
555
|
-
- spec/dummy/config/routes.rb
|
556
|
-
- spec/dummy/config/secrets.yml
|
557
|
-
- spec/dummy/config/settings.yml
|
558
|
-
- spec/dummy/config/settings/development.yml
|
559
|
-
- spec/dummy/config/settings/production.yml
|
560
|
-
- spec/dummy/config/settings/test.yml
|
561
|
-
- spec/dummy/config/settings/uat.yml
|
562
|
-
- spec/dummy/db/schema.rb
|
563
|
-
- spec/dummy/lib/assets/.keep
|
564
|
-
- spec/dummy/log/.keep
|
565
|
-
- spec/dummy/public/404.html
|
566
|
-
- spec/dummy/public/422.html
|
567
|
-
- spec/dummy/public/500.html
|
568
|
-
- spec/dummy/public/favicon.ico
|
569
|
-
- spec/dummy/tmp/cache/.gitkeep
|
570
|
-
- spec/integration/complex_id_references_spec.rb
|
571
|
-
- spec/integration/complex_naming_spec.rb
|
572
|
-
- spec/integration/complex_spec.rb
|
573
|
-
- spec/integration/connec_to_external_spec.rb
|
574
|
-
- spec/integration/external_to_connec_spec.rb
|
575
|
-
- spec/integration/id_references_spec.rb
|
576
|
-
- spec/integration/singleton_spec.rb
|
577
|
-
- spec/jobs/all_synchronizations_job_spec.rb
|
578
|
-
- spec/jobs/push_to_connec_job_spec.rb
|
579
|
-
- spec/jobs/push_to_connec_worker_spec.rb
|
580
|
-
- spec/jobs/synchronization_job_spec.rb
|
581
|
-
- spec/models/complex_entity_spec.rb
|
582
|
-
- spec/models/connec_helper_spec.rb
|
583
|
-
- spec/models/connector_logger_spec.rb
|
584
|
-
- spec/models/entity_base_spec.rb
|
585
|
-
- spec/models/entity_spec.rb
|
586
|
-
- spec/models/external_spec.rb
|
587
|
-
- spec/models/id_map_spec.rb
|
588
|
-
- spec/models/organization_spec.rb
|
589
|
-
- spec/models/sub_entity_base_spec.rb
|
590
|
-
- spec/models/synchronization_spec.rb
|
591
|
-
- spec/models/user_organization_rel_spec.rb
|
592
|
-
- spec/models/user_spec.rb
|
593
|
-
- spec/routing/connec_routing_spec.rb
|
594
|
-
- spec/spec_helper.rb
|
595
|
-
- template/Procfile
|
596
|
-
- template/application-sample.yml
|
597
|
-
- template/database.yml
|
598
|
-
- template/gitignore
|
599
|
-
- template/maestrano.rb
|
600
|
-
- template/maestrano_connector_template.rb
|
601
|
-
- template/routes.rb
|
602
|
-
- template/rubocop.yml
|
603
|
-
- template/settings/development.yml
|
604
|
-
- template/settings/production.yml
|
605
|
-
- template/settings/settings.yml
|
606
|
-
- template/settings/test.yml
|
607
|
-
- template/settings/uat.yml
|
608
|
-
- template/sidekiq.rb
|
609
|
-
- template/sidekiq.yml
|
610
|
-
- template/spec_helper.rb
|
611
|
-
homepage: http://github.com/maestrano/maestrano-connector-rails
|
473
|
+
homepage: https://github.com/maestrano/maestrano-connector-rails
|
612
474
|
licenses:
|
613
475
|
- MIT
|
614
476
|
metadata: {}
|
@@ -620,7 +482,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
620
482
|
requirements:
|
621
483
|
- - ">="
|
622
484
|
- !ruby/object:Gem::Version
|
623
|
-
version:
|
485
|
+
version: 2.3.0
|
624
486
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
625
487
|
requirements:
|
626
488
|
- - ">"
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.0.2.pre.RC6
|
@@ -1,179 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Maestrano::ConnecController, type: :controller do
|
4
|
-
routes { Maestrano::Connector::Rails::Engine.routes }
|
5
|
-
|
6
|
-
describe 'notifications' do
|
7
|
-
let(:notifications) { {} }
|
8
|
-
let(:group_id) { 'cld_333' }
|
9
|
-
let(:params) { {tenant: 'default'}.merge(notifications) }
|
10
|
-
let(:entity) { {group_id: group_id, last_name: 'Georges', first_name: 'Teddy'} }
|
11
|
-
subject { post :notifications, params }
|
12
|
-
|
13
|
-
context 'without authentication' do
|
14
|
-
before {
|
15
|
-
controller.class.before_filter :authenticate_maestrano!
|
16
|
-
}
|
17
|
-
|
18
|
-
it 'respond with unauthorized' do
|
19
|
-
subject
|
20
|
-
expect(response.status).to eq(401)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'with authentication' do
|
25
|
-
before {
|
26
|
-
controller.class.skip_before_filter :authenticate_maestrano!
|
27
|
-
}
|
28
|
-
|
29
|
-
it 'is a success' do
|
30
|
-
subject
|
31
|
-
expect(response.status).to eq(200)
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'with an unexpected error' do
|
35
|
-
let(:notifications) { {'people' => [entity]} }
|
36
|
-
it 'does nothing' do
|
37
|
-
allow(controller).to receive(:find_entity_class).and_raise('Unexpected error')
|
38
|
-
expect(Maestrano::Connector::Rails::External).to_not receive(:get_client)
|
39
|
-
subject
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context "with an unknown entity" do
|
44
|
-
let(:notifications) { {'people' => [entity]} }
|
45
|
-
before {
|
46
|
-
allow(Maestrano::Connector::Rails::External).to receive(:entities_list).and_return(%w())
|
47
|
-
}
|
48
|
-
|
49
|
-
it 'does nothing' do
|
50
|
-
expect(Maestrano::Connector::Rails::External).to_not receive(:get_client)
|
51
|
-
subject
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
context "with a known complex entity" do
|
56
|
-
let(:notifications) { {'leads' => [entity]} }
|
57
|
-
|
58
|
-
before {
|
59
|
-
allow(Maestrano::Connector::Rails::External).to receive(:entities_list).and_return(%w(contact_and_lead))
|
60
|
-
class Entities::ContactAndLead < Maestrano::Connector::Rails::ComplexEntity
|
61
|
-
def self.connec_entities_names
|
62
|
-
%w(Lead)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
module Entities::SubEntities end;
|
66
|
-
class Entities::SubEntities::Lead < Maestrano::Connector::Rails::SubEntityBase
|
67
|
-
end
|
68
|
-
}
|
69
|
-
|
70
|
-
it 'looks for an organization' do
|
71
|
-
expect(Maestrano::Connector::Rails::Organization).to receive(:find_by).with(uid: group_id, tenant: 'default')
|
72
|
-
subject
|
73
|
-
end
|
74
|
-
|
75
|
-
context 'when syncing' do
|
76
|
-
before {
|
77
|
-
allow(Entities::ContactAndLead).to receive(:external_entities_names).and_return(%w())
|
78
|
-
}
|
79
|
-
let!(:organization) { create(:organization, uid: group_id, oauth_uid: 'lala', sync_enabled: true) }
|
80
|
-
|
81
|
-
it 'process the data and push them' do
|
82
|
-
expect_any_instance_of(Entities::ContactAndLead).to receive(:before_sync)
|
83
|
-
expect_any_instance_of(Entities::ContactAndLead).to receive(:filter_connec_entities).with({"Lead"=>[entity]}).and_return({"Lead"=>[entity]})
|
84
|
-
expect_any_instance_of(Entities::ContactAndLead).to receive(:consolidate_and_map_data).with({"Lead"=>[entity]}, {}).and_return({})
|
85
|
-
expect_any_instance_of(Entities::ContactAndLead).to receive(:push_entities_to_external)
|
86
|
-
expect_any_instance_of(Entities::ContactAndLead).to receive(:after_sync)
|
87
|
-
begin
|
88
|
-
subject
|
89
|
-
rescue => e
|
90
|
-
puts e
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
context "with a known non complex entity" do
|
97
|
-
let(:notifications) { {'people' => [entity]} }
|
98
|
-
|
99
|
-
before {
|
100
|
-
allow(Maestrano::Connector::Rails::External).to receive(:entities_list).and_return(%w(person))
|
101
|
-
class Entities::Person < Maestrano::Connector::Rails::Entity
|
102
|
-
def self.connec_entity_name
|
103
|
-
'People'
|
104
|
-
end
|
105
|
-
end
|
106
|
-
}
|
107
|
-
|
108
|
-
it 'looks for an organization' do
|
109
|
-
expect(Maestrano::Connector::Rails::Organization).to receive(:find_by).with(uid: group_id, tenant: 'default')
|
110
|
-
subject
|
111
|
-
end
|
112
|
-
|
113
|
-
context 'with an invalid organization' do
|
114
|
-
context 'with no organization' do
|
115
|
-
it 'does nothing' do
|
116
|
-
expect(Maestrano::Connector::Rails::External).to_not receive(:get_client)
|
117
|
-
subject
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
context 'with an organization with no oauth' do
|
122
|
-
let!(:organization) { create(:organization, uid: group_id, oauth_uid: nil) }
|
123
|
-
|
124
|
-
it 'does nothing' do
|
125
|
-
expect(Maestrano::Connector::Rails::External).to_not receive(:get_client).with(organization)
|
126
|
-
subject
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
context 'with a valid organization' do
|
132
|
-
context 'with sync disabled' do
|
133
|
-
let!(:organization) { create(:organization, uid: group_id, oauth_uid: 'lala', sync_enabled: false) }
|
134
|
-
|
135
|
-
it 'does nothing' do
|
136
|
-
expect(Maestrano::Connector::Rails::External).to_not receive(:get_client).with(organization)
|
137
|
-
subject
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
context 'with sync disabled for this entity' do
|
142
|
-
let!(:organization) { create(:organization, uid: group_id, oauth_uid: 'lala', sync_enabled: true, synchronized_entities: {person: {can_push_to_connec: false}}) }
|
143
|
-
|
144
|
-
it 'does nothing' do
|
145
|
-
expect(Maestrano::Connector::Rails::External).to_not receive(:get_client).with(organization)
|
146
|
-
subject
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
context "when syncing" do
|
151
|
-
let!(:organization) { create(:organization, uid: group_id, oauth_uid: 'lala', sync_enabled: true) }
|
152
|
-
|
153
|
-
it 'process the data and push them' do
|
154
|
-
expect_any_instance_of(Entities::Person).to receive(:before_sync)
|
155
|
-
expect_any_instance_of(Entities::Person).to receive(:filter_connec_entities).and_return([entity])
|
156
|
-
expect_any_instance_of(Entities::Person).to receive(:consolidate_and_map_data).with([entity], []).and_return({})
|
157
|
-
expect_any_instance_of(Entities::Person).to receive(:push_entities_to_external)
|
158
|
-
expect_any_instance_of(Entities::Person).to receive(:after_sync)
|
159
|
-
subject
|
160
|
-
end
|
161
|
-
|
162
|
-
context 'with different entity name case and singular' do
|
163
|
-
let(:notifications) { {'Person' => [entity]} }
|
164
|
-
|
165
|
-
it 'process the data and push them' do
|
166
|
-
expect_any_instance_of(Entities::Person).to receive(:before_sync)
|
167
|
-
expect_any_instance_of(Entities::Person).to receive(:filter_connec_entities).and_return([entity])
|
168
|
-
expect_any_instance_of(Entities::Person).to receive(:consolidate_and_map_data).with([entity], []).and_return({})
|
169
|
-
expect_any_instance_of(Entities::Person).to receive(:push_entities_to_external)
|
170
|
-
expect_any_instance_of(Entities::Person).to receive(:after_sync)
|
171
|
-
subject
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Maestrano::DependanciesController, type: :controller do
|
4
|
-
routes { Maestrano::Connector::Rails::Engine.routes }
|
5
|
-
|
6
|
-
describe 'index' do
|
7
|
-
subject { get :index }
|
8
|
-
|
9
|
-
context 'without authentication' do
|
10
|
-
before {
|
11
|
-
controller.class.before_filter :authenticate_maestrano!
|
12
|
-
}
|
13
|
-
|
14
|
-
it 'respond with unauthorized' do
|
15
|
-
subject
|
16
|
-
expect(response.status).to eq(401)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context 'with authentication' do
|
21
|
-
before {
|
22
|
-
controller.class.skip_before_filter :authenticate_maestrano!
|
23
|
-
}
|
24
|
-
|
25
|
-
it 'renders the dependancies hash' do
|
26
|
-
subject
|
27
|
-
expect(response.body).to eql(Maestrano::Connector::Rails::ConnecHelper.dependancies.to_json)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|