|
2 | 2 | require 'json' |
3 | 3 |
|
4 | 4 | describe "Stats", type: :request do |
5 | | - let(:rendering_id) { 13 } |
| 5 | + let(:rendering_id) { '13' } |
6 | 6 | let(:scopes) { {'scopes' => {}, 'team' => {'id' => '1', 'name' => 'Operations'}} } |
7 | 7 | let(:schema) { |
8 | 8 | [ |
|
23 | 23 | team: 'Operations', |
24 | 24 | rendering_id: rendering_id, |
25 | 25 | exp: Time.now.to_i + 2.weeks.to_i, |
26 | | - permission_level: 'admin' |
| 26 | + permission_level: 'user' |
27 | 27 | }, ForestLiana.auth_secret, 'HS256') |
28 | 28 | } |
29 | 29 |
|
|
38 | 38 | before do |
39 | 39 | Rails.cache.write('forest.users', {'1' => { 'id' => 1, 'roleId' => 1, 'rendering_id' => '1' }}) |
40 | 40 | Rails.cache.write('forest.has_permission', true) |
41 | | - allow_any_instance_of(ForestLiana::Ability::Fetch) |
| 41 | + allow_any_instance_of(ForestLiana::Ability::Permission) |
42 | 42 | .to receive(:get_permissions) |
43 | 43 | .and_return( |
44 | 44 | { |
|
50 | 50 | "aggregateFieldName" => nil, |
51 | 51 | "sourceCollectionName" => "Owner" |
52 | 52 | }, |
| 53 | + { |
| 54 | + "type" => "Objective", |
| 55 | + "sourceCollectionName" => "Owner", |
| 56 | + "aggregateFieldName" => nil, |
| 57 | + "aggregator" => "Count", |
| 58 | + "objective" => 200, |
| 59 | + "filter" => nil, |
| 60 | + }, |
| 61 | + { |
| 62 | + "type" => "Pie", |
| 63 | + "sourceCollectionName" => "Owner", |
| 64 | + "aggregateFieldName" => nil, |
| 65 | + "groupByFieldName" => "id", |
| 66 | + "aggregator" => "Count", |
| 67 | + "filter" => nil, |
| 68 | + }, |
| 69 | + { |
| 70 | + "type" => "Line", |
| 71 | + "sourceCollectionName" => "Owner", |
| 72 | + "aggregateFieldName" => nil, |
| 73 | + "groupByFieldName" => "hired_at", |
| 74 | + "aggregator" => "Count", |
| 75 | + "timeRange" => "Week", |
| 76 | + "filter" => nil, |
| 77 | + }, |
53 | 78 | { |
54 | 79 | "type" => "Value", |
55 | 80 | "query" => "SELECT COUNT(*) AS value FROM products;" |
|
0 commit comments