forest_liana 6.6.1 → 7.0.0.beta.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/forest_liana/actions_controller.rb +58 -41
  3. data/app/controllers/forest_liana/application_controller.rb +2 -11
  4. data/app/controllers/forest_liana/associations_controller.rb +1 -1
  5. data/app/controllers/forest_liana/base_controller.rb +1 -1
  6. data/app/controllers/forest_liana/resources_controller.rb +7 -6
  7. data/app/serializers/forest_liana/intercom_attribute_serializer.rb +1 -1
  8. data/app/serializers/forest_liana/intercom_conversation_serializer.rb +1 -1
  9. data/app/serializers/forest_liana/mixpanel_event_serializer.rb +1 -1
  10. data/app/serializers/forest_liana/serializer_factory.rb +1 -1
  11. data/app/serializers/forest_liana/stat_serializer.rb +1 -1
  12. data/app/serializers/forest_liana/stripe_bank_account_serializer.rb +1 -1
  13. data/app/serializers/forest_liana/stripe_card_serializer.rb +1 -1
  14. data/app/serializers/forest_liana/stripe_invoice_serializer.rb +1 -1
  15. data/app/serializers/forest_liana/stripe_payment_serializer.rb +1 -1
  16. data/app/serializers/forest_liana/stripe_subscription_serializer.rb +1 -1
  17. data/app/services/forest_liana/apimap_sorter.rb +1 -0
  18. data/app/services/forest_liana/permissions_checker.rb +39 -33
  19. data/app/services/forest_liana/permissions_formatter.rb +1 -1
  20. data/app/services/forest_liana/permissions_getter.rb +1 -4
  21. data/app/services/forest_liana/smart_action_field_validator.rb +49 -0
  22. data/config/initializers/errors.rb +17 -0
  23. data/config/routes.rb +0 -1
  24. data/lib/forest_liana/bootstrapper.rb +2 -2
  25. data/lib/forest_liana/schema_file_updater.rb +8 -0
  26. data/lib/forest_liana/version.rb +1 -1
  27. data/spec/lib/forest_liana/schema_file_updater_spec.rb +94 -0
  28. data/spec/requests/actions_controller_spec.rb +69 -34
  29. data/spec/services/forest_liana/permissions_checker_acl_disabled_spec.rb +45 -69
  30. data/spec/services/forest_liana/permissions_checker_acl_enabled_spec.rb +39 -63
  31. data/spec/services/forest_liana/permissions_checker_live_queries_spec.rb +3 -3
  32. data/spec/services/forest_liana/permissions_formatter_spec.rb +11 -11
  33. data/spec/services/forest_liana/smart_action_field_validator_spec.rb +70 -0
  34. metadata +119 -117
  35. data/app/helpers/forest_liana/is_same_data_structure_helper.rb +0 -44
  36. data/spec/helpers/forest_liana/is_same_data_structure_helper_spec.rb +0 -87
@@ -75,7 +75,7 @@ module ForestLiana
75
75
  "users" => nil
76
76
  },
77
77
  },
78
- "scope" => nil
78
+ "segments" => nil
79
79
  },
80
80
  "no_rights_collection" => {
81
81
  "collection" => {
@@ -93,7 +93,7 @@ module ForestLiana
93
93
  "users" => nil
94
94
  }
95
95
  },
96
- "scope" => nil
96
+ "segments" => nil
97
97
  },
98
98
  },
99
99
  "meta" => {
@@ -146,6 +146,8 @@ module ForestLiana
146
146
 
147
147
  context 'with permissions coming from 2 different renderings' do
148
148
  let(:collection_name) { 'custom' }
149
+
150
+ let(:segments_permissions) { nil }
149
151
  let(:api_permissions_rendering_1) {
150
152
  {
151
153
  "data" => {
@@ -160,7 +162,7 @@ module ForestLiana
160
162
  "searchToEdit" => true
161
163
  },
162
164
  "actions" => { },
163
- "scope" => nil
165
+ "segments" => segments_permissions
164
166
  },
165
167
  },
166
168
  "meta" => {
@@ -190,11 +192,11 @@ module ForestLiana
190
192
  end
191
193
 
192
194
 
193
- context 'scopes cache' do
195
+ context 'renderings cache' do
194
196
  let(:fake_ressource) { collection_name }
195
197
  let(:rendering_id) { 1 }
196
198
  let(:collection_name) { 'custom' }
197
- let(:scope_permissions) { { rendering_id => { 'custom' => nil } } }
199
+ let(:segments_permissions) { { rendering_id => { 'custom' => nil } } }
198
200
  let(:api_permissions) {
199
201
  {
200
202
  "data" => {
@@ -209,7 +211,7 @@ module ForestLiana
209
211
  "searchToEdit" => true
210
212
  },
211
213
  "actions" => { },
212
- "scope" => nil
214
+ "segments" => nil
213
215
  },
214
216
  },
215
217
  "meta" => {
@@ -217,11 +219,11 @@ module ForestLiana
217
219
  }
218
220
  }
219
221
  }
220
- let(:api_permissions_scope_only) {
222
+ let(:api_permissions_rendering_only) {
221
223
  {
222
224
  "data" => {
223
225
  'collections' => { },
224
- 'renderings' => scope_permissions
226
+ 'renderings' => segments_permissions
225
227
  },
226
228
  "meta" => {
227
229
  "rolesACLActivated" => false
@@ -233,13 +235,13 @@ module ForestLiana
233
235
  # clones is called to duplicate the returned value and not use to same (which results in an error
234
236
  # as the permissions is edited through the formatter)
235
237
  allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(rendering_id) { api_permissions.clone }
236
- allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(rendering_id, rendering_specific_only: true).and_return(api_permissions_scope_only)
238
+ allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(rendering_id, rendering_specific_only: true).and_return(api_permissions_rendering_only)
237
239
  end
238
240
 
239
241
  context 'when checking once for authorization' do
240
242
  context 'when checking browseEnabled' do
241
243
  context 'when expiration value is set to its default' do
242
- it 'should not call the API to refresh the scopes cache' do
244
+ it 'should not call the API to refresh the renderings cache' do
243
245
  described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
244
246
 
245
247
  expect(ForestLiana::PermissionsGetter).to have_received(:get_permissions_for_rendering).with(rendering_id).once
@@ -254,7 +256,7 @@ module ForestLiana
254
256
  described_class.empty_cache
255
257
  end
256
258
 
257
- it 'should call the API to refresh the scopes cache' do
259
+ it 'should call the API to refresh the renderings cache' do
258
260
  described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
259
261
 
260
262
  expect(ForestLiana::PermissionsGetter).to have_received(:get_permissions_for_rendering).with(rendering_id).once
@@ -263,7 +265,7 @@ module ForestLiana
263
265
  end
264
266
  end
265
267
 
266
- # Only browse permission requires scopes
268
+ # Only browse permission requires segments
267
269
  context 'when checking exportEnabled' do
268
270
  context 'when expiration value is set in the past' do
269
271
  before do
@@ -273,7 +275,7 @@ module ForestLiana
273
275
  end
274
276
  end
275
277
 
276
- it 'should NOT call the API to refresh the scopes cache' do
278
+ it 'should NOT call the API to refresh the renderings cache' do
277
279
  described_class.new(fake_ressource, 'exportEnabled', rendering_id, user_id: user_id).is_authorized?
278
280
 
279
281
  expect(ForestLiana::PermissionsGetter).to have_received(:get_permissions_for_rendering).with(rendering_id).once
@@ -284,8 +286,8 @@ module ForestLiana
284
286
 
285
287
  context 'when checking twice for authorization' do
286
288
  context 'on the same rendering' do
287
- context 'when scopes permission has NOT expired' do
288
- it 'should NOT call the API to refresh the scopes permissions' do
289
+ context 'when renderings permission has NOT expired' do
290
+ it 'should NOT call the API to refresh the renderings permissions' do
289
291
  described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
290
292
  described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
291
293
 
@@ -294,14 +296,14 @@ module ForestLiana
294
296
  end
295
297
  end
296
298
 
297
- context 'when scopes permission has expired' do
299
+ context 'when renderings permission has expired' do
298
300
  before do
299
301
  allow(ENV).to receive(:[]).with('FOREST_PERMISSIONS_EXPIRATION_IN_SECONDS').and_return('-1')
300
302
  # Needed to enforce ENV stub
301
303
  described_class.empty_cache
302
304
  end
303
305
 
304
- it 'should call the API to refresh the scopes permissions' do
306
+ it 'should call the API to refresh the renderings permissions' do
305
307
  described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
306
308
  described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
307
309
 
@@ -313,7 +315,7 @@ module ForestLiana
313
315
 
314
316
  context 'on two different renderings' do
315
317
  let(:other_rendering_id) { 2 }
316
- let(:api_permissions_scope_only) {
318
+ let(:api_permissions_rendering_only) {
317
319
  {
318
320
  "data" => {
319
321
  'collections' => { },
@@ -330,10 +332,10 @@ module ForestLiana
330
332
 
331
333
  before do
332
334
  allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(other_rendering_id).and_return(api_permissions_copy)
333
- allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(other_rendering_id, rendering_specific_only: true).and_return(api_permissions_scope_only)
335
+ allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(other_rendering_id, rendering_specific_only: true).and_return(api_permissions_rendering_only)
334
336
  end
335
337
 
336
- it 'should not call the API to refresh the scopes permissions' do
338
+ it 'should not call the API to refresh the rederings permissions' do
337
339
  described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
338
340
  described_class.new(fake_ressource, 'browseEnabled', other_rendering_id, user_id: user_id).is_authorized?
339
341
 
@@ -350,7 +352,7 @@ module ForestLiana
350
352
  # Resource is only used to retrieve the collection name as it's stubbed it does not
351
353
  # need to be defined
352
354
  let(:fake_ressource) { collection_name }
353
- let(:default_rendering_id) { nil }
355
+ let(:default_rendering_id) { 1 }
354
356
  let(:api_permissions) { default_api_permissions }
355
357
  let(:collection_name) { 'all_rights_collection' }
356
358
 
@@ -380,14 +382,14 @@ module ForestLiana
380
382
  describe 'browseEnabled permission' do
381
383
  let(:collection_name) { 'custom' }
382
384
  subject { described_class.new(fake_ressource, 'browseEnabled', default_rendering_id, user_id: user_id) }
383
- let(:scope_permissions) { nil }
385
+ let(:segments_permissions) { nil }
384
386
  let(:default_api_permissions) {
385
387
  {
386
388
  "data" => {
387
389
  "custom" => {
388
390
  "collection" => collection_permissions,
389
391
  "actions" => { },
390
- "scope" => scope_permissions
392
+ "segments" => segments_permissions
391
393
  },
392
394
  },
393
395
  "meta" => {
@@ -480,6 +482,26 @@ module ForestLiana
480
482
  end
481
483
  end
482
484
 
485
+ context 'when segments are defined' do
486
+ let(:segments_permissions) { ['SELECT * FROM products;', 'SELECT * FROM sellers;'] }
487
+ let(:collection_list_parameters) { { :user_id => "1", :segmentQuery => segmentQuery } }
488
+
489
+ context 'when segments are passing validation' do
490
+ let(:segmentQuery) { 'SELECT * FROM products;' }
491
+ it 'should return true' do
492
+ expect(subject.is_authorized?).to be true
493
+ end
494
+ end
495
+
496
+ context 'when segments are NOT passing validation' do
497
+ let(:segmentQuery) { 'SELECT * FROM rockets WHERE name = "Starship";' }
498
+ it 'should return false' do
499
+ expect(subject.is_authorized?).to be false
500
+ end
501
+ end
502
+
503
+ end
504
+
483
505
  context 'when user has not the required permission' do
484
506
  let(:collection_permissions) {
485
507
  {
@@ -498,52 +520,6 @@ module ForestLiana
498
520
  end
499
521
  end
500
522
 
501
- context 'when scopes are defined' do
502
- let(:scope_permissions) { { 'dynamicScopesValues' => {}, 'filter' => { 'aggregator' => 'and', 'conditions' => [condition] } }}
503
- let(:collection_list_parameters) { { :user_id => "1", :filters => JSON.generate(condition) } }
504
-
505
- context 'when scopes are passing validation' do
506
- context 'when scope value is a string' do
507
- let(:condition) { { 'field' => 'field_1', 'operator' => 'equal', 'value' => true } }
508
-
509
- it 'should return true' do
510
- expect(subject.is_authorized?).to be true
511
- end
512
- end
513
-
514
- context 'when scope value is a boolean' do
515
- let(:condition) { { 'field' => 'field_1', 'operator' => 'equal', 'value' => 'true' } }
516
-
517
- it 'should return true' do
518
- expect(subject.is_authorized?).to be true
519
- end
520
- end
521
- end
522
-
523
- context 'when scopes are NOT passing validation' do
524
- let(:condition) { { 'field' => 'field_1', 'operator' => 'equal', 'value' => true } }
525
- let(:other_condition) {
526
- {
527
- aggregator: 'and',
528
- conditions: [
529
- { field: 'name', value: 'john', operator: 'equal' },
530
- { field: 'price', value: '2500', operator: 'equal' }
531
- ]
532
- }
533
- }
534
- let(:collection_list_parameters) {
535
- {
536
- :user_id => "1",
537
- :filters => JSON.generate(other_condition)
538
- }
539
- }
540
-
541
-
542
- it 'should return false' do
543
- expect(subject.is_authorized?).to be false
544
- end
545
- end
546
- end
547
523
  end
548
524
  end
549
525
 
@@ -50,7 +50,8 @@ module ForestLiana
50
50
  })
51
51
  ]
52
52
  }
53
- let(:scope_permissions) { nil }
53
+ let(:default_rendering_id) { 1 }
54
+ let(:segments_permissions) { { default_rendering_id => { 'segments' => nil } } }
54
55
  let(:default_api_permissions) {
55
56
  {
56
57
  "data" => {
@@ -116,14 +117,16 @@ module ForestLiana
116
117
  }
117
118
  },
118
119
  },
119
- 'renderings' => scope_permissions
120
+ 'renderings' => segments_permissions
121
+ },
122
+ "stats" => {
123
+ "queries"=>[],
120
124
  },
121
125
  "meta" => {
122
126
  "rolesACLActivated" => true
123
127
  }
124
128
  }
125
129
  }
126
- let(:default_rendering_id) { 1 }
127
130
 
128
131
  before do
129
132
  allow(ForestLiana).to receive(:apimap).and_return(schema)
@@ -174,7 +177,7 @@ module ForestLiana
174
177
  end
175
178
 
176
179
  let(:collection_name) { 'custom' }
177
- let(:scope_permissions) { { default_rendering_id => { 'custom' => nil }, 2 => { 'custom' => nil } } }
180
+ let(:segments_permissions) { { default_rendering_id => { 'custom' => nil }, 2 => { 'custom' => nil } } }
178
181
  let(:api_permissions_rendering_1) {
179
182
  {
180
183
  "data" => {
@@ -191,7 +194,7 @@ module ForestLiana
191
194
  "actions" => { }
192
195
  },
193
196
  },
194
- 'renderings' => scope_permissions
197
+ 'renderings' => segments_permissions
195
198
  },
196
199
  "meta" => {
197
200
  "rolesACLActivated" => true
@@ -242,10 +245,10 @@ module ForestLiana
242
245
  end
243
246
  end
244
247
 
245
- context 'scopes cache' do
248
+ context 'renderings cache' do
246
249
  let(:rendering_id) { 1 }
247
250
  let(:collection_name) { 'custom' }
248
- let(:scope_permissions) { { rendering_id => { 'custom' => nil } } }
251
+ let(:segments_permissions) { { rendering_id => { 'custom' => nil } } }
249
252
  let(:api_permissions) {
250
253
  {
251
254
  "data" => {
@@ -262,18 +265,18 @@ module ForestLiana
262
265
  "actions" => { }
263
266
  },
264
267
  },
265
- 'renderings' => scope_permissions
268
+ 'renderings' => segments_permissions
266
269
  },
267
270
  "meta" => {
268
271
  "rolesACLActivated" => true
269
272
  }
270
273
  }
271
274
  }
272
- let(:api_permissions_scope_only) {
275
+ let(:api_permissions_rendering_only) {
273
276
  {
274
277
  "data" => {
275
278
  'collections' => { },
276
- 'renderings' => scope_permissions
279
+ 'renderings' => segments_permissions
277
280
  },
278
281
  "meta" => {
279
282
  "rolesACLActivated" => true
@@ -283,13 +286,13 @@ module ForestLiana
283
286
 
284
287
  before do
285
288
  allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(rendering_id).and_return(api_permissions)
286
- allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(rendering_id, rendering_specific_only: true).and_return(api_permissions_scope_only)
289
+ allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(rendering_id, rendering_specific_only: true).and_return(api_permissions_rendering_only)
287
290
  end
288
291
 
289
292
  context 'when checking once for authorization' do
290
293
  context 'when checking browseEnabled' do
291
294
  context 'when expiration value is set to its default' do
292
- it 'should not call the API to refresh the scopes cache' do
295
+ it 'should not call the API to refresh the renderings cache' do
293
296
  described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
294
297
 
295
298
  expect(ForestLiana::PermissionsGetter).to have_received(:get_permissions_for_rendering).with(rendering_id).once
@@ -304,7 +307,7 @@ module ForestLiana
304
307
  described_class.empty_cache
305
308
  end
306
309
 
307
- it 'should call the API to refresh the scopes cache' do
310
+ it 'should call the API to refresh the renderings cache' do
308
311
  described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
309
312
 
310
313
  expect(ForestLiana::PermissionsGetter).to have_received(:get_permissions_for_rendering).with(rendering_id).once
@@ -313,7 +316,7 @@ module ForestLiana
313
316
  end
314
317
  end
315
318
 
316
- # Only browse permission requires scopes
319
+ # Only browse permission requires segments
317
320
  context 'when checking exportEnabled' do
318
321
  context 'when expiration value is set in the past' do
319
322
  before do
@@ -323,7 +326,7 @@ module ForestLiana
323
326
  end
324
327
  end
325
328
 
326
- it 'should NOT call the API to refresh the scopes cache' do
329
+ it 'should NOT call the API to refresh the rendering cache' do
327
330
  described_class.new(fake_ressource, 'exportEnabled', rendering_id, user_id: user_id).is_authorized?
328
331
 
329
332
  expect(ForestLiana::PermissionsGetter).to have_received(:get_permissions_for_rendering).with(rendering_id).once
@@ -334,8 +337,8 @@ module ForestLiana
334
337
 
335
338
  context 'when checking twice for authorization' do
336
339
  context 'on the same rendering' do
337
- context 'when scopes permission has NOT expired' do
338
- it 'should NOT call the API to refresh the scopes permissions' do
340
+ context 'when rendering permission has NOT expired' do
341
+ it 'should NOT call the API to refresh the rendering permissions' do
339
342
  described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
340
343
  described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
341
344
 
@@ -344,14 +347,14 @@ module ForestLiana
344
347
  end
345
348
  end
346
349
 
347
- context 'when scopes permission has expired' do
350
+ context 'when renderings permission has expired' do
348
351
  before do
349
352
  allow(ENV).to receive(:[]).with('FOREST_PERMISSIONS_EXPIRATION_IN_SECONDS').and_return('-1')
350
353
  # Needed to enforce ENV stub
351
354
  described_class.empty_cache
352
355
  end
353
356
 
354
- it 'should call the API to refresh the scopes permissions' do
357
+ it 'should call the API to refresh the rendering permissions' do
355
358
  described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
356
359
  described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
357
360
 
@@ -363,14 +366,17 @@ module ForestLiana
363
366
 
364
367
  context 'on two different renderings' do
365
368
  let(:other_rendering_id) { 2 }
366
- let(:api_permissions_scope_only) {
369
+ let(:api_permissions_rendering_only) {
367
370
  {
368
371
  "data" => {
369
372
  'collections' => { },
370
373
  'renderings' => {
371
- '2' => { 'custom' => nil }
374
+ other_rendering_id => { 'custom' => nil }
372
375
  }
373
376
  },
377
+ "stats" => {
378
+ "somestats" => [],
379
+ },
374
380
  "meta" => {
375
381
  "rolesACLActivated" => true
376
382
  }
@@ -378,10 +384,10 @@ module ForestLiana
378
384
  }
379
385
 
380
386
  before do
381
- allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(other_rendering_id, rendering_specific_only: true).and_return(api_permissions_scope_only)
387
+ allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(other_rendering_id, rendering_specific_only: true).and_return(api_permissions_rendering_only)
382
388
  end
383
389
 
384
- it 'should call the API to refresh the scopes permissions' do
390
+ it 'should call the API to refresh the rendering permissions' do
385
391
  described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
386
392
  described_class.new(fake_ressource, 'browseEnabled', other_rendering_id, user_id: user_id).is_authorized?
387
393
 
@@ -452,58 +458,28 @@ module ForestLiana
452
458
  end
453
459
  end
454
460
 
455
- context 'when scopes are defined' do
461
+ context 'when segments are defined' do
456
462
  let(:default_rendering_id) { 1 }
457
- let(:scope_permissions) {
463
+ let(:segments_permissions) {
458
464
  {
459
465
  default_rendering_id => {
460
466
  collection_name => {
461
- 'scope' => {
462
- 'dynamicScopesValues' => {},
463
- 'filter' => { 'aggregator' => 'and', 'conditions' => [condition] }
464
- }
467
+ 'segments' => ['SELECT * FROM products;', 'SELECT * FROM sellers;']
465
468
  }
466
469
  }
467
470
  }
468
471
  }
469
- let(:collection_list_parameters) { { :user_id => "1", :filters => JSON.generate(condition) } }
472
+ let(:collection_list_parameters) { { :user_id => "1", :segmentQuery => segmentQuery } }
470
473
 
471
- context 'when scopes are passing validation' do
472
- context 'when scope value is a string' do
473
- let(:condition) { { 'field' => 'field_1', 'operator' => 'equal', 'value' => true } }
474
-
475
- it 'should return true' do
476
- expect(subject.is_authorized?).to be true
477
- end
478
- end
479
-
480
- context 'when scope value is a boolean' do
481
- let(:condition) { { 'field' => 'field_1', 'operator' => 'equal', 'value' => 'true' } }
482
-
483
- it 'should return true' do
484
- expect(subject.is_authorized?).to be true
485
- end
474
+ context 'when segments are passing validation' do
475
+ let(:segmentQuery) { 'SELECT * FROM products;' }
476
+ it 'should return true' do
477
+ expect(subject.is_authorized?).to be true
486
478
  end
487
479
  end
488
480
 
489
- context 'when scopes are NOT passing validation' do
490
- let(:condition) { { 'field' => 'field_1', 'operator' => 'equal', 'value' => true } }
491
- let(:other_condition) {
492
- {
493
- aggregator: 'and',
494
- conditions: [
495
- { field: 'name', value: 'john', operator: 'equal' },
496
- { field: 'price', value: '2500', operator: 'equal' }
497
- ]
498
- }
499
- }
500
- let(:collection_list_parameters) {
501
- {
502
- :user_id => "1",
503
- :filters => JSON.generate(other_condition)
504
- }
505
- }
506
-
481
+ context 'when segments are NOT passing validation' do
482
+ let(:segmentQuery) { 'SELECT * FROM rockets WHERE name = "Starship";' }
507
483
  it 'should return false' do
508
484
  expect(subject.is_authorized?).to be false
509
485
  end