workos 0.10.1 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/.ruby-version +1 -1
  4. data/.semaphore/semaphore.yml +8 -2
  5. data/Gemfile.lock +49 -36
  6. data/README.md +13 -230
  7. data/lib/workos.rb +3 -0
  8. data/lib/workos/client.rb +21 -4
  9. data/lib/workos/connection.rb +12 -1
  10. data/lib/workos/directory.rb +53 -0
  11. data/lib/workos/directory_group.rb +44 -0
  12. data/lib/workos/directory_sync.rb +63 -7
  13. data/lib/workos/directory_user.rb +63 -0
  14. data/lib/workos/passwordless.rb +4 -0
  15. data/lib/workos/portal.rb +54 -1
  16. data/lib/workos/profile.rb +1 -2
  17. data/lib/workos/sso.rb +31 -6
  18. data/lib/workos/types.rb +3 -0
  19. data/lib/workos/types/connection_struct.rb +3 -0
  20. data/lib/workos/types/directory_group_struct.rb +13 -0
  21. data/lib/workos/types/directory_struct.rb +16 -0
  22. data/lib/workos/types/directory_user_struct.rb +19 -0
  23. data/lib/workos/types/intent_enum.rb +1 -0
  24. data/lib/workos/version.rb +1 -1
  25. data/sorbet/rbi/gems/addressable.rbi +199 -0
  26. data/sorbet/rbi/gems/ast.rbi +49 -0
  27. data/sorbet/rbi/gems/codecov.rbi +37 -0
  28. data/sorbet/rbi/gems/crack.rbi +62 -0
  29. data/sorbet/rbi/gems/docile.rbi +36 -0
  30. data/sorbet/rbi/gems/hashdiff.rbi +66 -0
  31. data/sorbet/rbi/gems/parallel.rbi +83 -0
  32. data/sorbet/rbi/gems/parser.rbi +1429 -0
  33. data/sorbet/rbi/gems/public_suffix.rbi +104 -0
  34. data/sorbet/rbi/gems/rainbow.rbi +118 -0
  35. data/sorbet/rbi/gems/rake.rbi +644 -0
  36. data/sorbet/rbi/gems/regexp_parser.rbi +926 -0
  37. data/sorbet/rbi/gems/rexml.rbi +628 -0
  38. data/sorbet/rbi/gems/rspec-core.rbi +1898 -0
  39. data/sorbet/rbi/gems/rspec-expectations.rbi +1127 -0
  40. data/sorbet/rbi/gems/rspec-mocks.rbi +1099 -0
  41. data/sorbet/rbi/gems/rspec-support.rbi +280 -0
  42. data/sorbet/rbi/gems/rspec.rbi +15 -0
  43. data/sorbet/rbi/gems/rubocop-ast.rbi +1355 -0
  44. data/sorbet/rbi/gems/rubocop.rbi +7253 -0
  45. data/sorbet/rbi/gems/ruby-progressbar.rbi +304 -0
  46. data/sorbet/rbi/gems/simplecov-html.rbi +35 -0
  47. data/sorbet/rbi/gems/simplecov.rbi +406 -0
  48. data/sorbet/rbi/gems/unicode-display_width.rbi +17 -0
  49. data/sorbet/rbi/gems/vcr.rbi +572 -0
  50. data/sorbet/rbi/gems/webmock.rbi +556 -0
  51. data/sorbet/rbi/gems/yard.rbi +1165 -0
  52. data/sorbet/rbi/sorbet-typed/lib/rake/all/rake.rbi +645 -0
  53. data/sorbet/rbi/sorbet-typed/lib/rspec-core/all/rspec-core.rbi +1891 -0
  54. data/sorbet/rbi/sorbet-typed/lib/rubocop/~>0.85/rubocop.rbi +2072 -0
  55. data/sorbet/rbi/sorbet-typed/lib/yard/all/yard.rbi +1214 -0
  56. data/sorbet/rbi/todo.rbi +1 -3
  57. data/spec/lib/workos/audit_trail_spec.rb +0 -8
  58. data/spec/lib/workos/directory_sync_spec.rb +347 -40
  59. data/spec/lib/workos/passwordless_spec.rb +0 -8
  60. data/spec/lib/workos/portal_spec.rb +65 -11
  61. data/spec/lib/workos/sso_spec.rb +142 -76
  62. data/spec/spec_helper.rb +2 -1
  63. data/spec/support/fixtures/vcr_cassettes/directory_sync/delete_directory.yml +72 -0
  64. data/spec/support/fixtures/vcr_cassettes/{sso/list_connections.yml → directory_sync/list_directories/with_after.yml} +7 -7
  65. data/spec/support/fixtures/vcr_cassettes/{sso/list_connections_with_limit_param.yml → directory_sync/list_directories/with_before.yml} +8 -8
  66. data/spec/support/fixtures/vcr_cassettes/{sso/list_connections_with_connection_type_param.yml → directory_sync/list_directories/with_domain.yml} +11 -10
  67. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_limit.yml +74 -0
  68. data/spec/support/fixtures/vcr_cassettes/directory_sync/{list_directories.yml → list_directories/with_no_options.yml} +1 -1
  69. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml +73 -0
  70. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml +76 -0
  71. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml +74 -0
  72. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml +78 -0
  73. data/spec/support/fixtures/vcr_cassettes/{sso/list_connections_with_before_param.yml → directory_sync/list_groups/with_limit.yml} +12 -11
  74. data/spec/support/fixtures/vcr_cassettes/directory_sync/{list_groups.yml → list_groups/with_no_options.yml} +16 -6
  75. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml +72 -0
  76. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml +86 -0
  77. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml +75 -0
  78. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml +93 -0
  79. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml +76 -0
  80. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml +75 -0
  81. data/spec/support/fixtures/vcr_cassettes/directory_sync/{list_users.yml → list_users/with_no_options.yml} +16 -6
  82. data/spec/support/fixtures/vcr_cassettes/organization/get.yml +73 -0
  83. data/spec/support/fixtures/vcr_cassettes/organization/get_invalid.yml +72 -0
  84. data/spec/support/fixtures/vcr_cassettes/organization/update.yml +73 -0
  85. data/spec/support/fixtures/vcr_cassettes/organization/update_invalid.yml +73 -0
  86. data/spec/support/fixtures/vcr_cassettes/portal/generate_link_dsync.yml +72 -0
  87. data/spec/support/fixtures/vcr_cassettes/portal/{generate_link.yml → generate_link_sso.yml} +1 -1
  88. data/spec/support/fixtures/vcr_cassettes/sso/create_connection_with_valid_source.yml +3 -3
  89. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_after.yml +73 -0
  90. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_before.yml +73 -0
  91. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml +73 -0
  92. data/spec/support/fixtures/vcr_cassettes/sso/{list_connections_with_domain_param.yml → list_connections/with_domain.yml} +6 -6
  93. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml +74 -0
  94. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml +73 -0
  95. data/spec/support/fixtures/vcr_cassettes/sso/{list_connections_with_organization_id_param.yml → list_connections/with_organization_id.yml} +6 -6
  96. data/workos.gemspec +2 -0
  97. metadata +109 -42
  98. data/sorbet/rbi/hidden-definitions/errors.txt +0 -24896
  99. data/sorbet/rbi/hidden-definitions/hidden.rbi +0 -38411
  100. data/sorbet/rbi/sorbet-typed/lib/bundler/all/bundler.rbi +0 -8684
  101. data/sorbet/rbi/sorbet-typed/lib/ruby/all/gem.rbi +0 -4222
  102. data/sorbet/rbi/sorbet-typed/lib/ruby/all/open3.rbi +0 -111
  103. data/sorbet/rbi/sorbet-typed/lib/ruby/all/resolv.rbi +0 -543
  104. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories_with_domain_param.yml +0 -63
  105. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups_with_directory_param.yml +0 -62
  106. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users_with_directory_param.yml +0 -62
  107. data/spec/support/fixtures/vcr_cassettes/sso/list_connections_with_after_param.yml +0 -72
@@ -2,14 +2,6 @@
2
2
  # typed: false
3
3
 
4
4
  describe WorkOS::Passwordless do
5
- before(:all) do
6
- WorkOS.key = 'key'
7
- end
8
-
9
- after(:all) do
10
- WorkOS.key = nil
11
- end
12
-
13
5
  describe '.create_session' do
14
6
  context 'with valid options payload' do
15
7
  let(:valid_options) do
@@ -2,14 +2,6 @@
2
2
  # typed: false
3
3
 
4
4
  describe WorkOS::Portal do
5
- before :all do
6
- WorkOS.key = 'test'
7
- end
8
-
9
- after :all do
10
- WorkOS.key = nil
11
- end
12
-
13
5
  describe '.create_organization' do
14
6
  context 'with valid payload' do
15
7
  it 'creates an organization' do
@@ -47,9 +39,9 @@ describe WorkOS::Portal do
47
39
  let(:organization) { 'org_01EHQMYV6MBK39QC5PZXHY59C3' }
48
40
 
49
41
  describe 'with a valid organization' do
50
- describe 'with the minimal params' do
42
+ context 'with the sso intent' do
51
43
  it 'returns an Admin Portal link' do
52
- VCR.use_cassette 'portal/generate_link' do
44
+ VCR.use_cassette 'portal/generate_link_sso' do
53
45
  portal_link = described_class.generate_link(
54
46
  intent: 'sso',
55
47
  organization: organization,
@@ -61,6 +53,21 @@ describe WorkOS::Portal do
61
53
  end
62
54
  end
63
55
  end
56
+
57
+ describe 'with the dsync intent' do
58
+ it 'returns an Admin Portal link' do
59
+ VCR.use_cassette 'portal/generate_link_dsync' do
60
+ portal_link = described_class.generate_link(
61
+ intent: 'dsync',
62
+ organization: organization,
63
+ )
64
+
65
+ expect(portal_link).to eq(
66
+ 'https://id.workos.com/portal/launch?secret=secret',
67
+ )
68
+ end
69
+ end
70
+ end
64
71
  end
65
72
 
66
73
  describe 'with an invalid organization' do
@@ -88,7 +95,7 @@ describe WorkOS::Portal do
88
95
  )
89
96
  end.to raise_error(
90
97
  ArgumentError,
91
- 'bogus-intent is not a valid value. `intent` must be in ["sso"]',
98
+ /bogus-intent is not a valid value/,
92
99
  )
93
100
  end
94
101
  end
@@ -173,4 +180,51 @@ describe WorkOS::Portal do
173
180
  end
174
181
  end
175
182
  end
183
+
184
+ describe '.get_organization' do
185
+ context 'with a valid id' do
186
+ it 'gets the organization details' do
187
+ VCR.use_cassette('organization/get') do
188
+ organization = described_class.get_organization(
189
+ id: 'org_01EZDF20TZEJXKPSX2BJRN6TV6',
190
+ )
191
+
192
+ expect(organization.id).to eq('org_01EZDF20TZEJXKPSX2BJRN6TV6')
193
+ expect(organization.name).to eq('Foo Corp')
194
+ expect(organization.domains.first[:domain]).to eq('foo-corp.com')
195
+ end
196
+ end
197
+ end
198
+
199
+ context 'with an invalid id' do
200
+ it 'raises an error' do
201
+ VCR.use_cassette('organization/get_invalid') do
202
+ expect do
203
+ described_class.get_organization(id: 'invalid')
204
+ end.to raise_error(
205
+ WorkOS::APIError,
206
+ 'Status 404, Not Found - request ID: ',
207
+ )
208
+ end
209
+ end
210
+ end
211
+ end
212
+
213
+ describe '.update_organization' do
214
+ context 'with valid payload' do
215
+ it 'creates an organization' do
216
+ VCR.use_cassette 'organization/update' do
217
+ organization = described_class.update_organization(
218
+ organization: 'org_01F29YJ068E52HGEB8ZQGC9MJG',
219
+ domains: ['example.me'],
220
+ name: 'Test Organization',
221
+ )
222
+
223
+ expect(organization.id).to eq('org_01F29YJ068E52HGEB8ZQGC9MJG')
224
+ expect(organization.name).to eq('Test Organization')
225
+ expect(organization.domains.first[:domain]).to eq('example.me')
226
+ end
227
+ end
228
+ end
229
+ end
176
230
  end
@@ -73,7 +73,41 @@ describe WorkOS::SSO do
73
73
  end
74
74
  end
75
75
 
76
- context 'with neither domain or provider' do
76
+ context 'with a connection' do
77
+ let(:args) do
78
+ {
79
+ connection: 'connection_123',
80
+ client_id: 'workos-proj-123',
81
+ redirect_uri: 'foo.com/auth/callback',
82
+ state: {
83
+ next_page: '/dashboard/edit',
84
+ }.to_s,
85
+ }
86
+ end
87
+ it 'returns a valid URL' do
88
+ authorization_url = described_class.authorization_url(**args)
89
+
90
+ expect(URI.parse(authorization_url)).to be_a URI
91
+ end
92
+
93
+ it 'returns the expected hostname' do
94
+ authorization_url = described_class.authorization_url(**args)
95
+
96
+ expect(URI.parse(authorization_url).host).to eq(WorkOS::API_HOSTNAME)
97
+ end
98
+
99
+ it 'returns the expected query string' do
100
+ authorization_url = described_class.authorization_url(**args)
101
+
102
+ expect(URI.parse(authorization_url).query).to eq(
103
+ 'client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback' \
104
+ '&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F' \
105
+ 'edit%22%7D&connection=connection_123',
106
+ )
107
+ end
108
+ end
109
+
110
+ context 'with neither connection, domain, or provider' do
77
111
  let(:args) do
78
112
  {
79
113
  client_id: 'workos-proj-123',
@@ -88,7 +122,7 @@ describe WorkOS::SSO do
88
122
  described_class.authorization_url(**args)
89
123
  end.to raise_error(
90
124
  ArgumentError,
91
- 'Either domain or provider is required.',
125
+ 'Either connection, domain, or provider is required.',
92
126
  )
93
127
  end
94
128
  end
@@ -159,10 +193,6 @@ describe WorkOS::SSO do
159
193
  end
160
194
 
161
195
  describe '.profile' do
162
- before do
163
- WorkOS.key = 'api-key'
164
- end
165
-
166
196
  let(:args) do
167
197
  {
168
198
  code: SecureRandom.hex(10),
@@ -274,14 +304,6 @@ describe WorkOS::SSO do
274
304
  end
275
305
 
276
306
  describe '.create_connection' do
277
- before(:all) do
278
- WorkOS.key = 'key'
279
- end
280
-
281
- after(:all) do
282
- WorkOS.key = nil
283
- end
284
-
285
307
  context 'with a valid source' do
286
308
  it 'creates a connection' do
287
309
  VCR.use_cassette('sso/create_connection_with_valid_source') do
@@ -293,6 +315,9 @@ describe WorkOS::SSO do
293
315
  expect(connection.connection_type).to eq('GoogleOAuth')
294
316
  expect(connection.name).to eq('Foo Corp')
295
317
  expect(connection.domains.first[:domain]).to eq('example.com')
318
+ expect(connection.organization_id).to eq('12345')
319
+ expect(connection.state).to eq('active')
320
+ expect(connection.status).to eq('linked')
296
321
  end
297
322
  end
298
323
  end
@@ -312,14 +337,6 @@ describe WorkOS::SSO do
312
337
  end
313
338
 
314
339
  describe '.promote_draft_connection' do
315
- before(:all) do
316
- WorkOS.key = 'key'
317
- end
318
-
319
- after(:all) do
320
- WorkOS.key = nil
321
- end
322
-
323
340
  let(:token) { 'draft_conn_id' }
324
341
  let(:client_id) { 'proj_0239u590h' }
325
342
 
@@ -357,54 +374,86 @@ describe WorkOS::SSO do
357
374
  end
358
375
 
359
376
  describe '.list_connections' do
360
- before(:all) do
361
- WorkOS.key = 'key'
362
- end
377
+ context 'with no options' do
378
+ it 'returns connections and metadata' do
379
+ expected_metadata = {
380
+ 'after' => nil,
381
+ 'before' => 'before_id',
382
+ }
363
383
 
364
- after(:all) do
365
- WorkOS.key = nil
366
- end
384
+ VCR.use_cassette 'sso/list_connections/with_no_options' do
385
+ connections = described_class.list_connections
367
386
 
368
- context 'with no options' do
369
- it 'returns connections' do
370
- VCR.use_cassette('sso/list_connections') do
371
- connections = WorkOS::SSO.list_connections
372
- expect(connections.size).to eq(1)
387
+ expect(connections.data.size).to eq(3)
388
+ expect(connections.list_metadata).to eq(expected_metadata)
373
389
  end
374
390
  end
375
391
  end
376
392
 
377
393
  context 'with connection_type option' do
378
- it 'returns connections' do
379
- VCR.use_cassette('sso/list_connections_with_connection_type_param') do
380
- connections = WorkOS::SSO.list_connections(
394
+ it 'forms the proper request to the API' do
395
+ request_args = [
396
+ '/connections?connection_type=OktaSAML',
397
+ 'Content-Type' => 'application/json'
398
+ ]
399
+
400
+ expected_request = Net::HTTP::Get.new(*request_args)
401
+
402
+ expect(Net::HTTP::Get).to receive(:new).with(*request_args).
403
+ and_return(expected_request)
404
+
405
+ VCR.use_cassette 'sso/list_connections/with_connection_type' do
406
+ connections = described_class.list_connections(
381
407
  connection_type: 'OktaSAML',
382
408
  )
383
- expect(connections.first['connection_type']).to eq('OktaSAML')
409
+
410
+ expect(connections.data.size).to eq(3)
411
+ expect(connections.data.first.connection_type).to eq('OktaSAML')
384
412
  end
385
413
  end
386
414
  end
387
415
 
388
416
  context 'with domain option' do
389
- it 'returns connections' do
390
- VCR.use_cassette('sso/list_connections_with_domain_param') do
391
- connections = WorkOS::SSO.list_connections(
417
+ it 'forms the proper request to the API' do
418
+ request_args = [
419
+ '/connections?domain=foo-corp.com',
420
+ 'Content-Type' => 'application/json'
421
+ ]
422
+
423
+ expected_request = Net::HTTP::Get.new(*request_args)
424
+
425
+ expect(Net::HTTP::Get).to receive(:new).with(*request_args).
426
+ and_return(expected_request)
427
+
428
+ VCR.use_cassette 'sso/list_connections/with_domain' do
429
+ connections = described_class.list_connections(
392
430
  domain: 'foo-corp.com',
393
431
  )
394
- domains = connections.first['domains']
395
- expect(domains.first['domain']).to eq('foo-corp.com')
432
+
433
+ expect(connections.data.size).to eq(1)
396
434
  end
397
435
  end
398
436
  end
399
437
 
400
438
  context 'with organization_id option' do
401
- it 'returns connections' do
402
- VCR.use_cassette('sso/list_connections_with_organization_id_param') do
403
- connections = WorkOS::SSO.list_connections(
439
+ it 'forms the proper request to the API' do
440
+ request_args = [
441
+ '/connections?organization_id=org_01EGS4P7QR31EZ4YWD1Z1XA176',
442
+ 'Content-Type' => 'application/json'
443
+ ]
444
+
445
+ expected_request = Net::HTTP::Get.new(*request_args)
446
+
447
+ expect(Net::HTTP::Get).to receive(:new).with(*request_args).
448
+ and_return(expected_request)
449
+
450
+ VCR.use_cassette 'sso/list_connections/with_organization_id' do
451
+ connections = described_class.list_connections(
404
452
  organization_id: 'org_01EGS4P7QR31EZ4YWD1Z1XA176',
405
453
  )
406
- expect(connections.size).to eq(1)
407
- expect(connections.first['organization_id']).to eq(
454
+
455
+ expect(connections.data.size).to eq(1)
456
+ expect(connections.data.first.organization_id).to eq(
408
457
  'org_01EGS4P7QR31EZ4YWD1Z1XA176',
409
458
  )
410
459
  end
@@ -412,48 +461,73 @@ describe WorkOS::SSO do
412
461
  end
413
462
 
414
463
  context 'with limit option' do
415
- it 'returns connections' do
416
- VCR.use_cassette('sso/list_connections_with_limit_param') do
417
- connections = WorkOS::SSO.list_connections(
418
- limit: 1,
464
+ it 'forms the proper request to the API' do
465
+ request_args = [
466
+ '/connections?limit=2',
467
+ 'Content-Type' => 'application/json'
468
+ ]
469
+
470
+ expected_request = Net::HTTP::Get.new(*request_args)
471
+
472
+ expect(Net::HTTP::Get).to receive(:new).with(*request_args).
473
+ and_return(expected_request)
474
+
475
+ VCR.use_cassette 'sso/list_connections/with_limit' do
476
+ connections = described_class.list_connections(
477
+ limit: 2,
419
478
  )
420
- expect(connections.size).to eq(1)
479
+
480
+ expect(connections.data.size).to eq(2)
421
481
  end
422
482
  end
423
483
  end
424
484
 
425
485
  context 'with before option' do
426
- it 'returns connections' do
427
- VCR.use_cassette('sso/list_connections_with_before_param') do
428
- connections = WorkOS::SSO.list_connections(
486
+ it 'forms the proper request to the API' do
487
+ request_args = [
488
+ '/connections?before=conn_01EQKPMQAPV02H270HKVNS4CTA',
489
+ 'Content-Type' => 'application/json'
490
+ ]
491
+
492
+ expected_request = Net::HTTP::Get.new(*request_args)
493
+
494
+ expect(Net::HTTP::Get).to receive(:new).with(*request_args).
495
+ and_return(expected_request)
496
+
497
+ VCR.use_cassette 'sso/list_connections/with_before' do
498
+ connections = described_class.list_connections(
429
499
  before: 'conn_01EQKPMQAPV02H270HKVNS4CTA',
430
500
  )
431
- expect(connections.size).to eq(1)
501
+
502
+ expect(connections.data.size).to eq(3)
432
503
  end
433
504
  end
434
505
  end
435
506
 
436
507
  context 'with after option' do
437
- it 'returns connections' do
438
- VCR.use_cassette('sso/list_connections_with_after_param') do
439
- connections = WorkOS::SSO.list_connections(
508
+ it 'forms the proper request to the API' do
509
+ request_args = [
510
+ '/connections?after=conn_01EQKPMQAPV02H270HKVNS4CTA',
511
+ 'Content-Type' => 'application/json'
512
+ ]
513
+
514
+ expected_request = Net::HTTP::Get.new(*request_args)
515
+
516
+ expect(Net::HTTP::Get).to receive(:new).with(*request_args).
517
+ and_return(expected_request)
518
+
519
+ VCR.use_cassette 'sso/list_connections/with_after' do
520
+ connections = described_class.list_connections(
440
521
  after: 'conn_01EQKPMQAPV02H270HKVNS4CTA',
441
522
  )
442
- expect(connections.size).to eq(1)
523
+
524
+ expect(connections.data.size).to eq(3)
443
525
  end
444
526
  end
445
527
  end
446
528
  end
447
529
 
448
530
  describe '.get_connection' do
449
- before(:all) do
450
- WorkOS.key = 'key'
451
- end
452
-
453
- after(:all) do
454
- WorkOS.key = nil
455
- end
456
-
457
531
  context 'with a valid id' do
458
532
  it 'gets the connection details' do
459
533
  VCR.use_cassette('sso/get_connection_with_valid_id') do
@@ -484,14 +558,6 @@ describe WorkOS::SSO do
484
558
  end
485
559
 
486
560
  describe '.delete_connection' do
487
- before(:all) do
488
- WorkOS.key = 'key'
489
- end
490
-
491
- after(:all) do
492
- WorkOS.key = nil
493
- end
494
-
495
561
  context 'with a valid id' do
496
562
  it 'returns true' do
497
563
  VCR.use_cassette('sso/delete_connection_with_valid_id') do
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- # typed: true
2
+ # typed: false
3
3
 
4
4
  require 'simplecov'
5
5
  SimpleCov.start
@@ -48,5 +48,6 @@ RSpec.configure do |config|
48
48
  end
49
49
  end)
50
50
 
51
+ config.before(:all) { WorkOS.key ||= '' }
51
52
  config.before(:each) { VCR.turn_on! }
52
53
  end