marty 2.5.2 → 2.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +4 -0
  3. data/.rubocop.yml +7 -0
  4. data/.rubocop_todo.yml +11 -589
  5. data/Gemfile +9 -9
  6. data/Gemfile.lock +1 -1
  7. data/Rakefile +1 -3
  8. data/app/components/marty/api_auth_view.rb +3 -3
  9. data/app/components/marty/api_config_view.rb +8 -8
  10. data/app/components/marty/api_log_view.rb +16 -20
  11. data/app/components/marty/auth_app.rb +6 -6
  12. data/app/components/marty/base_rule_view.rb +27 -19
  13. data/app/components/marty/config_view.rb +12 -9
  14. data/app/components/marty/data_grid_view.rb +26 -26
  15. data/app/components/marty/delorean_rule_view.rb +0 -1
  16. data/app/components/marty/event_view.rb +27 -27
  17. data/app/components/marty/extras/layout.rb +26 -26
  18. data/app/components/marty/extras/misc.rb +2 -2
  19. data/app/components/marty/grid.rb +13 -13
  20. data/app/components/marty/grid_append_only.rb +0 -1
  21. data/app/components/marty/import_type_view.rb +13 -13
  22. data/app/components/marty/import_view.rb +17 -16
  23. data/app/components/marty/log_view.rb +16 -14
  24. data/app/components/marty/main_auth_app.rb +59 -59
  25. data/app/components/marty/main_auth_app/client/main_auth_app.js +3 -3
  26. data/app/components/marty/mcfly_grid_panel.rb +10 -10
  27. data/app/components/marty/new_posting_form.rb +11 -11
  28. data/app/components/marty/new_posting_window.rb +0 -1
  29. data/app/components/marty/posting_grid.rb +12 -13
  30. data/app/components/marty/promise_view.rb +6 -6
  31. data/app/components/marty/report_form.rb +50 -53
  32. data/app/components/marty/report_select.rb +27 -27
  33. data/app/components/marty/reporting.rb +4 -4
  34. data/app/components/marty/script_form.rb +40 -42
  35. data/app/components/marty/script_grid.rb +24 -24
  36. data/app/components/marty/script_tester.rb +40 -42
  37. data/app/components/marty/scripting.rb +25 -27
  38. data/app/components/marty/simple_app.rb +24 -9
  39. data/app/components/marty/tag_grid.rb +12 -13
  40. data/app/components/marty/user_view.rb +35 -35
  41. data/app/controllers/marty/application_controller.rb +3 -4
  42. data/app/controllers/marty/components_controller.rb +1 -1
  43. data/app/controllers/marty/delayed_job_controller.rb +1 -0
  44. data/app/controllers/marty/diagnostic/controller.rb +4 -6
  45. data/app/controllers/marty/job_controller.rb +6 -6
  46. data/app/controllers/marty/report_controller.rb +11 -11
  47. data/app/controllers/marty/rpc_controller.rb +15 -16
  48. data/app/helpers/marty/script_set.rb +4 -4
  49. data/app/models/marty/api_auth.rb +4 -5
  50. data/app/models/marty/api_config.rb +1 -1
  51. data/app/models/marty/base.rb +9 -8
  52. data/app/models/marty/base_rule.rb +18 -13
  53. data/app/models/marty/config.rb +4 -5
  54. data/app/models/marty/data_grid.rb +157 -181
  55. data/app/models/marty/delorean_rule.rb +63 -62
  56. data/app/models/marty/enum.rb +1 -1
  57. data/app/models/marty/event.rb +56 -59
  58. data/app/models/marty/helper.rb +38 -6
  59. data/app/models/marty/import_type.rb +6 -6
  60. data/app/models/marty/log.rb +3 -2
  61. data/app/models/marty/name_validator.rb +3 -2
  62. data/app/models/marty/pg_enum.rb +3 -4
  63. data/app/models/marty/posting.rb +20 -24
  64. data/app/models/marty/promise.rb +28 -30
  65. data/app/models/marty/script.rb +30 -28
  66. data/app/models/marty/tag.rb +8 -8
  67. data/app/models/marty/token.rb +2 -2
  68. data/app/models/marty/user.rb +24 -23
  69. data/app/models/marty/vw_promise.rb +10 -11
  70. data/config/routes.rb +2 -2
  71. data/delorean/blame_report.dl +268 -0
  72. data/{spec/dummy/delorean/fields.dl → delorean/marty_fields.dl} +8 -0
  73. data/delorean/table_report.dl +34 -0
  74. data/docker-compose.dummy.yml +2 -3
  75. data/lib/marty/aws/base.rb +8 -8
  76. data/lib/marty/aws/request.rb +4 -4
  77. data/lib/marty/cache_adapters/mcfly_ruby_cache.rb +1 -0
  78. data/lib/marty/content_handler.rb +25 -25
  79. data/lib/marty/data_change.rb +49 -71
  80. data/lib/marty/data_conversion.rb +20 -28
  81. data/lib/marty/data_exporter.rb +25 -28
  82. data/lib/marty/data_importer.rb +25 -27
  83. data/lib/marty/engine.rb +1 -2
  84. data/lib/marty/json_schema.rb +22 -24
  85. data/lib/marty/logger.rb +6 -9
  86. data/lib/marty/mcfly_model.rb +20 -24
  87. data/lib/marty/migrations.rb +37 -35
  88. data/lib/marty/monkey.rb +33 -33
  89. data/lib/marty/permissions.rb +18 -18
  90. data/lib/marty/promise_job.rb +17 -17
  91. data/lib/marty/promise_proxy.rb +6 -6
  92. data/lib/marty/relation.rb +6 -7
  93. data/lib/marty/rpc_call.rb +13 -12
  94. data/lib/marty/rule_script_set.rb +32 -28
  95. data/lib/marty/schema_helper.rb +37 -51
  96. data/lib/marty/util.rb +25 -24
  97. data/lib/marty/version.rb +1 -1
  98. data/lib/marty/xl.rb +121 -115
  99. data/make-dummy.mk +3 -0
  100. data/marty.gemspec +21 -21
  101. data/other/marty/api/base.rb +34 -35
  102. data/other/marty/diagnostic/aws/ec2_instance.rb +8 -8
  103. data/other/marty/diagnostic/base.rb +13 -14
  104. data/other/marty/diagnostic/collection.rb +2 -1
  105. data/other/marty/diagnostic/connections.rb +8 -6
  106. data/other/marty/diagnostic/database.rb +1 -0
  107. data/other/marty/diagnostic/delayed_job_version.rb +7 -9
  108. data/other/marty/diagnostic/delayed_job_worker_total_count.rb +1 -1
  109. data/other/marty/diagnostic/delayed_job_workers.rb +1 -1
  110. data/other/marty/diagnostic/environment_variables.rb +17 -15
  111. data/other/marty/diagnostic/fatal.rb +1 -1
  112. data/other/marty/diagnostic/node.rb +5 -9
  113. data/other/marty/diagnostic/nodes.rb +7 -5
  114. data/other/marty/diagnostic/packer.rb +7 -7
  115. data/other/marty/diagnostic/reporter.rb +24 -27
  116. data/other/marty/diagnostic/version.rb +3 -5
  117. data/script/rails +2 -1
  118. data/spec/controllers/application_controller_spec.rb +6 -6
  119. data/spec/controllers/delayed_job_controller_spec.rb +4 -4
  120. data/spec/controllers/diagnostic/controller_spec.rb +59 -60
  121. data/spec/controllers/job_controller_spec.rb +68 -69
  122. data/spec/controllers/rpc_controller_spec.rb +353 -359
  123. data/spec/controllers/rpc_import_spec.rb +15 -16
  124. data/spec/dummy/delorean/blame_report.dl +110 -15
  125. data/spec/dummy/delorean/data_report.dl +4 -4
  126. data/spec/dummy/delorean/marty_fields.dl +63 -0
  127. data/spec/dummy/delorean/table_report.dl +34 -0
  128. data/spec/features/auth_app_spec.rb +1 -2
  129. data/spec/features/data_import_spec.rb +2 -3
  130. data/spec/features/enum_spec.rb +42 -46
  131. data/spec/features/jobs_dashboard_spec.rb +14 -8
  132. data/spec/features/log_view_spec.rb +40 -43
  133. data/spec/features/reporting_spec.rb +15 -15
  134. data/spec/features/rule_spec.rb +195 -190
  135. data/spec/features/scripting_spec.rb +17 -20
  136. data/spec/features/scripting_test_spec.rb +32 -33
  137. data/spec/features/user_view_spec.rb +15 -17
  138. data/spec/job_helper.rb +11 -11
  139. data/spec/lib/data_blame_spec.rb +82 -0
  140. data/spec/lib/data_exporter_spec.rb +31 -32
  141. data/spec/lib/data_importer_spec.rb +382 -395
  142. data/spec/lib/delorean_query_spec.rb +117 -119
  143. data/spec/lib/json_schema_spec.rb +382 -392
  144. data/spec/lib/logger_spec.rb +23 -24
  145. data/spec/lib/mcfly_model_spec.rb +112 -109
  146. data/spec/lib/migrations_spec.rb +10 -10
  147. data/spec/lib/struct_compare_spec.rb +6 -6
  148. data/spec/lib/table_report_spec.rb +90 -0
  149. data/spec/lib/xl_spec.rb +63 -65
  150. data/spec/lib/xl_styles_spec.rb +16 -19
  151. data/spec/models/api_auth_spec.rb +30 -30
  152. data/spec/models/config_spec.rb +32 -32
  153. data/spec/models/data_grid_spec.rb +642 -655
  154. data/spec/models/event_spec.rb +96 -88
  155. data/spec/models/import_type_spec.rb +20 -20
  156. data/spec/models/posting_spec.rb +35 -35
  157. data/spec/models/promise_spec.rb +5 -5
  158. data/spec/models/rule_spec.rb +280 -269
  159. data/spec/models/script_spec.rb +27 -18
  160. data/spec/models/user_spec.rb +9 -9
  161. data/spec/other/diagnostic/base_spec.rb +20 -19
  162. data/spec/other/diagnostic/collection_spec.rb +6 -5
  163. data/spec/other/diagnostic/delayed_job_version_spec.rb +1 -1
  164. data/spec/other/diagnostic/delayed_job_workers_spec.rb +8 -8
  165. data/spec/other/diagnostic/reporter_spec.rb +31 -33
  166. data/spec/spec_helper.rb +5 -5
  167. data/spec/support/chromedriver.rb +3 -5
  168. data/spec/support/components/netzke_combobox.rb +1 -1
  169. data/spec/support/components/netzke_grid.rb +17 -17
  170. data/spec/support/custom_matchers.rb +2 -2
  171. data/spec/support/download_helper.rb +1 -1
  172. data/spec/support/helper.rb +1 -2
  173. data/spec/support/netzke.rb +31 -31
  174. data/spec/support/performance_helper.rb +8 -8
  175. data/spec/support/post_run_logger.rb +1 -2
  176. data/spec/support/setup.rb +1 -4
  177. data/spec/support/shared_connection.rb +2 -2
  178. data/spec/support/structure_compare.rb +21 -22
  179. data/spec/support/suite.rb +1 -2
  180. data/spec/support/users.rb +5 -6
  181. metadata +32 -26
@@ -21,7 +21,7 @@ describe Marty::Promise, slow: true do
21
21
  @time = DateTime.now
22
22
  expect(Marty::Promise.count).to eq(0)
23
23
  engine = Marty::ScriptSet.new.get_engine(NAME_A)
24
- engine.background_eval("Y", {"p_title" => NAME_A}, ["d"])
24
+ engine.background_eval('Y', { 'p_title' => NAME_A }, ['d'])
25
25
  sleep 5
26
26
  Marty::Promise.cleanup
27
27
  expect(Marty::Promise.count).to eq(10)
@@ -37,25 +37,25 @@ describe Marty::Promise, slow: true do
37
37
  stop_delayed_job
38
38
  end
39
39
 
40
- it "should retain jobs that were run less than 4 hours ago" do
40
+ it 'should retain jobs that were run less than 4 hours ago' do
41
41
  Timecop.freeze(@time + 4.hours)
42
42
  Marty::Promise.cleanup
43
43
  expect(Marty::Promise.count).to eq(10)
44
44
  end
45
45
 
46
- it "should cleanup jobs that are older than 4 hours" do
46
+ it 'should cleanup jobs that are older than 4 hours' do
47
47
  Timecop.freeze(@time + 4.hours + 1.minute)
48
48
  Marty::Promise.cleanup
49
49
  expect(Marty::Promise.count).to eq(0)
50
50
  end
51
51
 
52
- it "should allow cleanup of all jobs when forced by admin" do
52
+ it 'should allow cleanup of all jobs when forced by admin' do
53
53
  Timecop.freeze(@time + 4.hours)
54
54
  Marty::Promise.cleanup(true)
55
55
  expect(Marty::Promise.count).to eq(0)
56
56
  end
57
57
 
58
- it "should provide a live search scope for filtering by user or role" do
58
+ it 'should provide a live search scope for filtering by user or role' do
59
59
  expect(Marty::VwPromise.live_search('XXX').size).to eq(0)
60
60
  expect(Marty::VwPromise.live_search('marty').size).to eq(10)
61
61
  expect(Marty::VwPromise.live_search('Admin').size).to eq(10)
@@ -1,15 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Marty::RuleSpec
4
- describe "Rule" do
4
+ describe 'Rule' do
5
5
  before(:all) do
6
6
  @save_file = "/tmp/save_#{Process.pid}.psql"
7
7
  save_clean_db(@save_file)
8
8
  marty_whodunnit
9
9
  Marty::Script.load_scripts
10
- @ruleopts_myrule=['simple_result', 'computed_value', 'final_value',
11
- 'grid_sum', 'c1', 'sr2']
12
- @ruleopts_xyz=['bvlength', 'bv']
10
+ @ruleopts_myrule = ['simple_result', 'computed_value', 'final_value',
11
+ 'grid_sum', 'c1', 'sr2']
12
+ @ruleopts_xyz = ['bvlength', 'bv']
13
13
  end
14
14
  after(:all) do
15
15
  restore_clean_db(@save_file)
@@ -18,21 +18,21 @@ module Marty::RuleSpec
18
18
  dt = DateTime.parse('2017-1-1')
19
19
  p = File.expand_path('../../fixtures/csv/rule', __FILE__)
20
20
  [Marty::DataGrid, Gemini::XyzRule, Gemini::MyRule].each do |klass|
21
- f = "%s/%s.csv" % [p, klass.to_s.sub(/(Gemini|Marty)::/,'')]
22
- Marty::DataImporter.do_import(klass, File.read(f), dt, nil, nil, ",")
21
+ f = '%s/%s.csv' % [p, klass.to_s.sub(/(Gemini|Marty)::/, '')]
22
+ Marty::DataImporter.do_import(klass, File.read(f), dt, nil, nil, ',')
23
23
  end
24
24
  Marty::Tag.do_create('2017-01-01', 'tag')
25
25
  end
26
- context "validation" do
26
+ context 'validation' do
27
27
  subject do
28
- guards = (@g_array ? {"g_array" =>@g_array} : {}) +
29
- (@g_single ? {"g_single" =>@g_single} : {}) +
30
- (@g_string ? {"g_string" =>@g_string} : {}) +
31
- (@g_bool.nil? ? {} : {"g_bool" => @g_bool}) +
32
- (@g_nullbool.nil? ? {} : {"g_nullbool" => @g_nullbool}) +
33
- (@g_range ? {"g_range" =>@g_range} : {}) +
34
- (@g_integer ? {"g_integer" =>@g_integer} : {})
35
- Gemini::MyRule.create!(name: "testrule",
28
+ guards = (@g_array ? { 'g_array' => @g_array } : {}) +
29
+ (@g_single ? { 'g_single' => @g_single } : {}) +
30
+ (@g_string ? { 'g_string' => @g_string } : {}) +
31
+ (@g_bool.nil? ? {} : { 'g_bool' => @g_bool }) +
32
+ (@g_nullbool.nil? ? {} : { 'g_nullbool' => @g_nullbool }) +
33
+ (@g_range ? { 'g_range' => @g_range } : {}) +
34
+ (@g_integer ? { 'g_integer' => @g_integer } : {})
35
+ Gemini::MyRule.create!(name: 'testrule',
36
36
  rule_type: @rule_type,
37
37
  start_dt: @start_dt || '2013-1-1',
38
38
  end_dt: @end_dt,
@@ -42,85 +42,84 @@ module Marty::RuleSpec
42
42
  results: @results || {}
43
43
  )
44
44
  end
45
- it "detects type errors" do
45
+ it 'detects type errors' do
46
46
  @rule_type = 'SimpleRule'
47
- @g_integer = "abc"
48
- expect{subject}.to raise_error(/Guards - Wrong type for 'g_integer'/)
47
+ @g_integer = 'abc'
48
+ expect { subject }.to raise_error(/Guards - Wrong type for 'g_integer'/)
49
49
  end
50
- it "detects value errors 1" do
51
- @rule_type = "SimpleRule"
52
- @g_array = ["G1V1", "abcd"]
53
- expect{subject}.to raise_error(/Guards - Bad value 'abcd' for 'g_array'/)
50
+ it 'detects value errors 1' do
51
+ @rule_type = 'SimpleRule'
52
+ @g_array = ['G1V1', 'abcd']
53
+ expect { subject }.to raise_error(/Guards - Bad value 'abcd' for 'g_array'/)
54
54
  end
55
- it "detects value errors 2" do
56
- @rule_type = "SimpleRule"
57
- @g_array = ["G1V1", "xyz", "abc"]
55
+ it 'detects value errors 2' do
56
+ @rule_type = 'SimpleRule'
57
+ @g_array = ['G1V1', 'xyz', 'abc']
58
58
  exp = /Guards - Bad values 'xyz', 'abc' for 'g_array'/
59
- expect{subject}.to raise_error(exp)
59
+ expect { subject }.to raise_error(exp)
60
60
  end
61
- it "detects arity errors 1" do
62
- @rule_type = "SimpleRule"
63
- @g_single = ["G2V1","G2V2"]
61
+ it 'detects arity errors 1' do
62
+ @rule_type = 'SimpleRule'
63
+ @g_single = ['G2V1', 'G2V2']
64
64
  exp = /Guards - Wrong arity for 'g_single' .expected single got multi./
65
- expect{subject}.to raise_error(exp)
65
+ expect { subject }.to raise_error(exp)
66
66
  end
67
- it "detects arity errors 2" do
68
- @rule_type = "SimpleRule"
69
- @g_array = "G1V1"
67
+ it 'detects arity errors 2' do
68
+ @rule_type = 'SimpleRule'
69
+ @g_array = 'G1V1'
70
70
  exp = /Guards - Wrong arity for 'g_array' .expected multi got single./
71
- expect{subject}.to raise_error(exp)
71
+ expect { subject }.to raise_error(exp)
72
72
  end
73
- it "detects errors in computed guards" do
74
- @rule_type = "SimpleRule"
75
- @computed_guards = {"guard1"=> "zvjsdf12.z8*"}
73
+ it 'detects errors in computed guards' do
74
+ @rule_type = 'SimpleRule'
75
+ @computed_guards = { 'guard1' => 'zvjsdf12.z8*' }
76
76
  exp = /Computed - Error in rule 'testrule' field 'computed_guards': Syntax error/
77
- expect{subject}.to raise_error(exp)
77
+ expect { subject }.to raise_error(exp)
78
78
  end
79
- it "detects errors in computed results" do
80
- @rule_type = "SimpleRule"
81
- @results = {"does_not_compute"=> "zvjsdf12.z8*"}
82
- @grids = {"grid1"=>"DataGrid1","grid2"=>"DataGrid2"}
79
+ it 'detects errors in computed results' do
80
+ @rule_type = 'SimpleRule'
81
+ @results = { 'does_not_compute' => 'zvjsdf12.z8*' }
82
+ @grids = { 'grid1' => 'DataGrid1', 'grid2' => 'DataGrid2' }
83
83
  exp = /Computed - Error in rule 'testrule' field 'results': Syntax error/
84
- expect{subject}.to raise_error(exp)
84
+ expect { subject }.to raise_error(exp)
85
85
  end
86
- it "detects errors in computed results 2" do
87
- @rule_type = "SimpleRule"
88
- @results = {"does_not_compute"=> "zvjsdf12.z8*"}
89
- @grids = {"grid1"=>"DataGrid1","grid2"=>"DataGrid1","grid3"=>"DataGrid3"}
86
+ it 'detects errors in computed results 2' do
87
+ @rule_type = 'SimpleRule'
88
+ @results = { 'does_not_compute' => 'zvjsdf12.z8*' }
89
+ @grids = { 'grid1' => 'DataGrid1', 'grid2' => 'DataGrid1', 'grid3' => 'DataGrid3' }
90
90
  exp = /Computed - Error in rule 'testrule' field 'results': Syntax error/
91
- expect{subject}.to raise_error(exp)
91
+ expect { subject }.to raise_error(exp)
92
92
  end
93
- it "detects errors in computed results 3" do
94
- @rule_type = "SimpleRule"
95
- @results = {"does_not_compute"=> "zvjsdf12.z8*"}
96
- @grids = {"grid1"=>"DataGrid1","grid2"=>"DataGrid1","grid3"=>"DataGrid1"}
93
+ it 'detects errors in computed results 3' do
94
+ @rule_type = 'SimpleRule'
95
+ @results = { 'does_not_compute' => 'zvjsdf12.z8*' }
96
+ @grids = { 'grid1' => 'DataGrid1', 'grid2' => 'DataGrid1', 'grid3' => 'DataGrid1' }
97
97
  exp = /Computed - Error in rule 'testrule' field 'results': Syntax error/
98
- expect{subject}.to raise_error(exp)
98
+ expect { subject }.to raise_error(exp)
99
99
  end
100
- it "reports bad grid names" do
101
- @rule_type = "SimpleRule"
102
- @grids = {"grid1"=>"xyz","grid2"=>"DataGrid2","grid3"=>"DataGrid1"}
100
+ it 'reports bad grid names' do
101
+ @rule_type = 'SimpleRule'
102
+ @grids = { 'grid1' => 'xyz', 'grid2' => 'DataGrid2', 'grid3' => 'DataGrid1' }
103
103
  exp = /Grids - Bad grid name 'xyz' for 'grid1'/
104
- expect{subject}.to raise_error(exp)
104
+ expect { subject }.to raise_error(exp)
105
105
  end
106
- it "sets guard defaults correctly" do
107
- vals = Gemini::MyRule.all.map do
108
- |r|
109
- [r.name, r.simple_guards["g_has_default"]]
106
+ it 'sets guard defaults correctly' do
107
+ vals = Gemini::MyRule.all.map do |r|
108
+ [r.name, r.simple_guards['g_has_default']]
110
109
  end
111
- expect(vals.sort).to eq([["Rule1", "different"],
112
- ["Rule2", "string default"],
113
- ["Rule2a", "string default"],
114
- ["Rule2b", "string default"],
115
- ["Rule2c", "string default"],
116
- ["Rule3", "string default"],
117
- ["Rule4", "string default"],
118
- ["Rule5", "foo"]].sort)
110
+ expect(vals.sort).to eq([['Rule1', 'different'],
111
+ ['Rule2', 'string default'],
112
+ ['Rule2a', 'string default'],
113
+ ['Rule2b', 'string default'],
114
+ ['Rule2c', 'string default'],
115
+ ['Rule3', 'string default'],
116
+ ['Rule4', 'string default'],
117
+ ['Rule5', 'foo']].sort)
119
118
  end
120
119
  end
121
- context "validation (xyz type)" do
120
+ context 'validation (xyz type)' do
122
121
  subject do
123
- r=Gemini::XyzRule.create!(name: "testrule",
122
+ r = Gemini::XyzRule.create!(name: 'testrule',
124
123
  rule_type: @rule_type,
125
124
  start_dt: @start_dt || '2013-1-1',
126
125
  end_dt: @end_dt,
@@ -128,237 +127,249 @@ module Marty::RuleSpec
128
127
  computed_guards: @computed_guards || {},
129
128
  grids: @grids || {},
130
129
  results: @results || {}
131
- )
130
+ )
132
131
  r.reload
133
132
  end
134
- it "detects script errors" do
133
+ it 'detects script errors' do
135
134
  @rule_type = 'XRule'
136
- @results = {"x"=>"zx sdf wer"}
135
+ @results = { 'x' => 'zx sdf wer' }
137
136
  exp = /Computed - Error in rule 'testrule' field 'results': Syntax error/
138
- expect{subject}.to raise_error(exp)
137
+ expect { subject }.to raise_error(exp)
139
138
  end
140
- it "rule script stuff overrides 1" do
139
+ it 'rule script stuff overrides 1' do
141
140
  @rule_type = 'XRule'
142
- @computed_guards = {"abc"=>"true", "xyz_guard"=> "err err err"}
141
+ @computed_guards = { 'abc' => 'true', 'xyz_guard' => 'err err err' }
143
142
  exp = /Computed - Error in rule 'testrule' field 'xyz': Syntax error/
144
- expect{subject}.to raise_error(exp)
143
+ expect { subject }.to raise_error(exp)
145
144
  end
146
- it "rule script stuff overrides 2" do
145
+ it 'rule script stuff overrides 2' do
147
146
  @rule_type = 'XRule'
148
- @computed_guards = {"abc"=>"err err err", "xyz_guard"=> "xyz_param"}
147
+ @computed_guards = { 'abc' => 'err err err', 'xyz_guard' => 'xyz_param' }
149
148
  exp = /Computed - Error in rule 'testrule' field 'computed_guards': Syntax error/
150
- expect{subject}.to raise_error(exp)
149
+ expect { subject }.to raise_error(exp)
151
150
  end
152
- it "rule script stuff overrides 3" do
151
+ it 'rule script stuff overrides 3' do
153
152
  @rule_type = 'XRule'
154
- @computed_guards = {"abc"=>"true", "xyz_guard"=> "!xyz_param"}
153
+ @computed_guards = { 'abc' => 'true', 'xyz_guard' => '!xyz_param' }
155
154
  rule = subject
156
- expect(rule.compute_xyz('infinity',true)).to be false
157
- expect(rule.compute_xyz('infinity',false)).to be true
155
+ expect(rule.compute_xyz('infinity', true)).to be false
156
+ expect(rule.compute_xyz('infinity', false)).to be true
158
157
  end
159
- it "no error" do
158
+ it 'no error' do
160
159
  @rule_type = 'XRule'
161
- @results = {"x"=>"1"}
162
- expect{subject}.not_to raise_error
160
+ @results = { 'x' => '1' }
161
+ expect { subject }.not_to raise_error
163
162
  end
164
163
  end
165
164
 
166
- context "lookups" do
167
- it "matches" do
165
+ context 'lookups' do
166
+ it 'matches' do
168
167
  lookup = Gemini::MyRule.get_matches('infinity',
169
- {'rule_type'=>'SimpleRule'},
170
- {'g_array'=>'G1V3'})
168
+ { 'rule_type' => 'SimpleRule' },
169
+ 'g_array' => 'G1V3')
171
170
  expect(lookup.to_a.count).to eq(1)
172
- expect(lookup.first.name).to eq("Rule1")
171
+ expect(lookup.first.name).to eq('Rule1')
173
172
  lookup = Gemini::MyRule.get_matches('infinity',
174
- {'rule_type'=>'SimpleRule',
173
+ { 'rule_type' => 'SimpleRule',
175
174
 
176
- 'other_flag'=>true},
175
+ 'other_flag' => true },
177
176
  {})
178
177
  expect(lookup.to_a.count).to eq(4)
179
- expect(lookup.map{|l|l.name}.to_set).to eq(Set["Rule2","Rule2a",
180
- "Rule2b", "Rule2c"])
178
+ expect(lookup.map(&:name).to_set).to eq(Set['Rule2', 'Rule2a',
179
+ 'Rule2b', 'Rule2c'])
181
180
  lookup = Gemini::MyRule.get_matches('infinity',
182
- {'rule_type'=>'ComplexRule',
183
- 'other_flag'=>false},
181
+ { 'rule_type' => 'ComplexRule',
182
+ 'other_flag' => false },
184
183
  {})
185
184
  expect(lookup.to_a.count).to eq(1)
186
- expect(lookup.first.name).to eq("Rule3")
185
+ expect(lookup.first.name).to eq('Rule3')
187
186
  # bool false matches bool nil
188
187
  lookup = Gemini::MyRule.get_matches('infinity',
189
- {'rule_type'=>'ComplexRule',
190
- 'other_flag'=>false},
191
- {'g_bool'=>false})
188
+ { 'rule_type' => 'ComplexRule',
189
+ 'other_flag' => false },
190
+ 'g_bool' => false)
192
191
  expect(lookup.to_a.count).to eq(1)
193
- expect(lookup.first.name).to eq("Rule3")
192
+ expect(lookup.first.name).to eq('Rule3')
194
193
  lookup = Gemini::MyRule.get_matches('infinity',
195
- {'rule_type'=>'ComplexRule'},
196
- {'g_string'=>'def'})
194
+ { 'rule_type' => 'ComplexRule' },
195
+ 'g_string' => 'def')
197
196
  expect(lookup.to_a.count).to eq(1)
198
- expect(lookup.first.name).to eq("Rule3")
197
+ expect(lookup.first.name).to eq('Rule3')
199
198
  lookup = Gemini::MyRule.get_matches('infinity',
200
- {'rule_type'=>'ComplexRule'},
201
- {'g_string'=>'abc'})
199
+ { 'rule_type' => 'ComplexRule' },
200
+ 'g_string' => 'abc')
202
201
  expect(lookup).to eq([])
203
202
  lookup = Gemini::MyRule.get_matches('infinity',
204
- {'rule_type'=>'SimpleRule'},
205
- {'g_bool'=>true, "g_range"=>25,
206
- 'g_integer'=>99})
203
+ { 'rule_type' => 'SimpleRule' },
204
+ 'g_bool' => true, 'g_range' => 25,
205
+ 'g_integer' => 99)
207
206
  expect(lookup.to_a.count).to eq(1)
208
- expect(lookup.first.name).to eq("Rule2a")
207
+ expect(lookup.first.name).to eq('Rule2a')
209
208
  lookup = Gemini::MyRule.get_matches('infinity',
210
- {'rule_type'=>'SimpleRule'},
211
- {'g_bool'=>true, "g_range"=>75})
209
+ { 'rule_type' => 'SimpleRule' },
210
+ 'g_bool' => true, 'g_range' => 75)
212
211
  expect(lookup.to_a.count).to eq(1)
213
- expect(lookup.first.name).to eq("Rule1")
212
+ expect(lookup.first.name).to eq('Rule1')
214
213
  lookup = Gemini::MyRule.get_matches('infinity',
215
- {'rule_type'=>'SimpleRule'},
216
- {'g_bool'=>true, "g_range"=>75,
217
- 'g_integer'=>11})
214
+ { 'rule_type' => 'SimpleRule' },
215
+ 'g_bool' => true, 'g_range' => 75,
216
+ 'g_integer' => 11)
218
217
  expect(lookup).to eq([])
219
218
  lookup = Gemini::MyRule.get_matches('infinity',
220
- {'rule_type'=>'SimpleRule'},
221
- {'g_bool'=>true, "g_range"=>75,
222
- 'g_integer'=>10})
219
+ { 'rule_type' => 'SimpleRule' },
220
+ 'g_bool' => true, 'g_range' => 75,
221
+ 'g_integer' => 10)
223
222
  expect(lookup.to_a.count).to eq(1)
224
- expect(lookup.first.name).to eq("Rule1")
223
+ expect(lookup.first.name).to eq('Rule1')
225
224
  lookup = Gemini::MyRule.get_matches('infinity',
226
- {'rule_type'=>'SimpleRule'},
227
- {'g_bool'=>false, "g_range"=>25,
228
- 'g_integer'=>10})
225
+ { 'rule_type' => 'SimpleRule' },
226
+ 'g_bool' => false, 'g_range' => 25,
227
+ 'g_integer' => 10)
229
228
  expect(lookup.to_a.count).to eq(1)
230
- expect(lookup.first.name).to eq("Rule2c")
229
+ expect(lookup.first.name).to eq('Rule2c')
231
230
  lookup = Gemini::MyRule.get_matches('infinity',
232
- {'rule_type'=>'SimpleRule'}, {})
231
+ { 'rule_type' => 'SimpleRule' }, {})
233
232
  expect(lookup.to_a.count).to eq(5)
234
233
  lookup = Gemini::MyRule.get_matches('infinity',
235
- {'rule_dt'=>"2017-3-1 02:00:00"},
234
+ { 'rule_dt' => '2017-3-1 02:00:00' },
236
235
  {})
237
236
  expect(lookup.to_a.count).to eq(6)
238
- expect(lookup.pluck(:name).to_set).to eq(Set["Rule1", "Rule2", "Rule2a",
239
- "Rule2b", "Rule2c", "Rule3"])
237
+ expect(lookup.pluck(:name).to_set).to eq(Set['Rule1', 'Rule2', 'Rule2a',
238
+ 'Rule2b', 'Rule2c', 'Rule3'])
240
239
  lookup = Gemini::MyRule.get_matches('infinity',
241
- {'rule_dt'=>"2017-4-1 16:00:00"},
240
+ { 'rule_dt' => '2017-4-1 16:00:00' },
242
241
  {})
243
242
  expect(lookup.to_a.count).to eq(1)
244
- expect(lookup.pluck(:name).first).to eq("Rule4")
243
+ expect(lookup.pluck(:name).first).to eq('Rule4')
245
244
  lookup = Gemini::MyRule.get_matches('infinity',
246
- {'rule_dt'=>"2016-12-31"}, {})
245
+ { 'rule_dt' => '2016-12-31' }, {})
247
246
  expect(lookup.to_a).to eq([])
248
247
  lookup = Gemini::MyRule.get_matches('infinity',
249
- {'rule_dt'=>"2017-5-1 00:00:01"}, {})
248
+ { 'rule_dt' => '2017-5-1 00:00:01' }, {})
250
249
  expect(lookup.to_a).to eq([])
251
250
  lookup = Gemini::MyRule.get_matches('infinity', {},
252
- {"g_bool_def"=>false,
253
- "g_nbool_def"=>true})
251
+ 'g_bool_def' => false,
252
+ 'g_nbool_def' => true)
254
253
  expect(lookup.to_a.count).to eq(1)
255
- expect(lookup.pluck(:name).first).to eq("Rule1")
254
+ expect(lookup.pluck(:name).first).to eq('Rule1')
256
255
  end
257
256
  end
258
- context "rule compute" do
259
- let(:complex) { Gemini::MyRule.get_matches('infinity',
260
- {'rule_type'=>'ComplexRule'},
261
- {'g_string'=>'def'}).first }
262
- let(:xyz) { Gemini::XyzRule.get_matches('infinity',
263
- {'rule_type'=>'ZRule'},
264
- {'g_integer'=> 2}).first }
265
- let(:simple) {
257
+ context 'rule compute' do
258
+ let(:complex) do
266
259
  Gemini::MyRule.get_matches('infinity',
267
- {'rule_type'=>'SimpleRule'},
268
- {'g_bool'=>true, "g_range"=>25}).first }
269
- let(:simple2a) {
260
+ { 'rule_type' => 'ComplexRule' },
261
+ 'g_string' => 'def').first
262
+ end
263
+ let(:xyz) do
264
+ Gemini::XyzRule.get_matches('infinity',
265
+ { 'rule_type' => 'ZRule' },
266
+ 'g_integer' => 2).first
267
+ end
268
+ let(:simple) do
270
269
  Gemini::MyRule.get_matches('infinity',
271
- {'rule_type'=>'SimpleRule'},
272
- {'g_bool'=>true, "g_integer"=>99}).first }
273
- let(:simple2b) {
270
+ { 'rule_type' => 'SimpleRule' },
271
+ 'g_bool' => true, 'g_range' => 25).first
272
+ end
273
+ let(:simple2a) do
274
274
  Gemini::MyRule.get_matches('infinity',
275
- {'rule_type'=>'SimpleRule'},
276
- {'g_bool'=>true, "g_integer"=>999}).first }
277
- let(:altgridmethod) {
275
+ { 'rule_type' => 'SimpleRule' },
276
+ 'g_bool' => true, 'g_integer' => 99).first
277
+ end
278
+ let(:simple2b) do
279
+ Gemini::MyRule.get_matches('infinity',
280
+ { 'rule_type' => 'SimpleRule' },
281
+ 'g_bool' => true, 'g_integer' => 999).first
282
+ end
283
+ let(:altgridmethod) do
278
284
  Gemini::MyRule.get_matches('infinity',
279
- {'rule_type'=>'ComplexRule'},
280
- {"g_integer"=>3757}).first }
281
- let(:gridcomputedname) {
285
+ { 'rule_type' => 'ComplexRule' },
286
+ 'g_integer' => 3757).first
287
+ end
288
+ let(:gridcomputedname) do
282
289
  Gemini::MyRule.get_matches('infinity',
283
- {'rule_type'=>'ComplexRule'},
284
- {"g_string"=>"Hi Mom",
285
- "g_integer"=>11}).first }
286
- it "computed guards work" do
287
- c = complex.compute(@ruleopts_myrule, {"pt"=>Time.zone.now,
288
- 'param2'=>'def'})
289
- expect(c).to eq({"cguard2"=>[false, "a string"]})
290
- end
291
- it "returns simple results via #fixed_results" do
292
- expect(simple.fixed_results["simple_result"]).to eq("b value")
293
- expect(simple.fixed_results["sr2"]).to eq(true)
294
- expect(simple.fixed_results["sr3"]).to eq(123)
295
- ssq = "string with single quotes"
296
- expect(simple.fixed_results["single_quote"]).to eq(ssq)
297
- swh = " string that contains a # character"
298
- expect(simple.fixed_results["stringwithhash"]).to eq(swh)
290
+ { 'rule_type' => 'ComplexRule' },
291
+ 'g_string' => 'Hi Mom',
292
+ 'g_integer' => 11).first
293
+ end
294
+ it 'computed guards work' do
295
+ c = complex.compute(@ruleopts_myrule, 'pt' => Time.zone.now,
296
+ 'param2' => 'def')
297
+ expect(c).to eq('cguard2' => [false, 'a string'])
298
+ end
299
+ it 'returns simple results via #fixed_results' do
300
+ expect(simple.fixed_results['simple_result']).to eq('b value')
301
+ expect(simple.fixed_results['sr2']).to eq(true)
302
+ expect(simple.fixed_results['sr3']).to eq(123)
303
+ ssq = 'string with single quotes'
304
+ expect(simple.fixed_results['single_quote']).to eq(ssq)
305
+ swh = ' string that contains a # character'
306
+ expect(simple.fixed_results['stringwithhash']).to eq(swh)
299
307
  expect(simple.fixed_results.count).to eq(5)
300
308
  allow_any_instance_of(Delorean::Engine).
301
309
  to receive(:evaluate).and_raise('hi mom')
302
- expect{simple.compute(@ruleopts_myrule,
303
- {"pt"=>Time.now})}.to raise_error(/hi mom/)
310
+ expect do
311
+ simple.compute(@ruleopts_myrule,
312
+ 'pt' => Time.now)
313
+ end .to raise_error(/hi mom/)
304
314
  # simple2a should return results without evaluation (they are all fixed)
305
- expect(simple2a.compute(@ruleopts_myrule, {"pt"=>Time.zone.now})).to eq(
306
- {"simple_result"=>"b value",
307
- "sr2"=>true,
308
- })
315
+ expect(simple2a.compute(@ruleopts_myrule, 'pt' => Time.zone.now)).to eq(
316
+ 'simple_result' => 'b value',
317
+ 'sr2' => true,
318
+ )
309
319
  # simple2b should return grid results without evaluation
310
320
  expect(simple2b.compute(@ruleopts_myrule,
311
- {"pt"=>Time.zone.now,
312
- 'param1'=> 66,
313
- 'param2'=>'abc',
314
- 'paramb'=>false})).
315
- to eq({"grid1_grid_result"=>3,
316
- "grid2_grid_result"=>1300})
317
-
321
+ 'pt' => Time.zone.now,
322
+ 'param1' => 66,
323
+ 'param2' => 'abc',
324
+ 'paramb' => false)).
325
+ to eq('grid1_grid_result' => 3,
326
+ 'grid2_grid_result' => 1300)
327
+ end
328
+ it 'returns computed results' do
329
+ c = complex.compute(@ruleopts_myrule, 'pt' => Time.zone.now,
330
+ 'param1' => 66,
331
+ 'param2' => 'abc',
332
+ 'paramb' => false)
333
+ expect(c).to eq('simple_result' => 'c value',
334
+ 'computed_value' => 19, 'grid1_grid_result' => 3,
335
+ 'grid2_grid_result' => 1300)
336
+ end
337
+ it 'returns computed results (with delorean import)' do
338
+ c = xyz.compute(@ruleopts_xyz, 'pt' => Time.zone.now + 1,
339
+ 'p1' => 12,
340
+ 'p2' => 3,
341
+ 'flavor' => 'cherry')
342
+ expect(c).to eq('bvlength' => 13, 'bv' => 'cherry --> 36',
343
+ 'grid1_grid_result' => 19)
318
344
  end
319
- it "returns computed results" do
320
- c = complex.compute(@ruleopts_myrule, {"pt"=>Time.zone.now,
321
- 'param1'=> 66,
322
- 'param2'=>'abc',
323
- 'paramb'=>false})
324
- expect(c).to eq({"simple_result"=>"c value",
325
- "computed_value"=>19, "grid1_grid_result"=>3,
326
- "grid2_grid_result"=>1300})
327
- end
328
- it "returns computed results (with delorean import)" do
329
- c = xyz.compute(@ruleopts_xyz, {"pt"=>Time.zone.now+1,
330
- "p1"=>12,
331
- "p2"=>3,
332
- "flavor"=>"cherry"})
333
- expect(c).to eq({"bvlength"=>13,"bv"=>"cherry --> 36",
334
- "grid1_grid_result"=>19})
335
- end
336
- it "reports bad grid name" do
345
+ it 'reports bad grid name' do
337
346
  exp = Regexp.new("Error .results. in rule '\\d+:Rule4': "\
338
- "DataGridX grid not found")
339
- expect{gridcomputedname.compute(@ruleopts_myrule,
340
- {"pt"=>Time.zone.now,
341
- 'param1'=> 66,
342
- 'param2'=>'abc',
343
- 'paramb'=>false})}.to raise_error(exp)
344
- end
345
- it "grids embedded in result work properly and receive prior attrs" do
346
- v = altgridmethod.compute(@ruleopts_myrule, {"pt"=>Time.zone.now,
347
- 'param1'=> 45,
348
- 'param2' => 1})
349
- expect(v["final_value"]).to eq(15)
350
- end
351
- it "exceptions/logging" do
347
+ 'DataGridX grid not found')
348
+ expect do
349
+ gridcomputedname.compute(@ruleopts_myrule,
350
+ 'pt' => Time.zone.now,
351
+ 'param1' => 66,
352
+ 'param2' => 'abc',
353
+ 'paramb' => false)
354
+ end .to raise_error(exp)
355
+ end
356
+ it 'grids embedded in result work properly and receive prior attrs' do
357
+ v = altgridmethod.compute(@ruleopts_myrule, 'pt' => Time.zone.now,
358
+ 'param1' => 45,
359
+ 'param2' => 1)
360
+ expect(v['final_value']).to eq(15)
361
+ end
362
+ it 'exceptions/logging' do
352
363
  r6, r7, r8 = [6, 7, 8].map do |i|
353
364
  Gemini::XyzRule.get_matches('infinity',
354
- {'rule_type'=>'ZRule'},
355
- {'g_integer'=>i}).first
365
+ { 'rule_type' => 'ZRule' },
366
+ 'g_integer' => i).first
356
367
  end
357
- pt = Time.zone.now+1
358
- input = {"pt"=>pt,
359
- "p1"=>12,
360
- "p2"=>3,
361
- "flavor"=>"cherry"}
368
+ pt = Time.zone.now + 1
369
+ input = { 'pt' => pt,
370
+ 'p1' => 12,
371
+ 'p2' => 3,
372
+ 'flavor' => 'cherry' }
362
373
  v1 = r6.compute(@ruleopts_xyz, input)
363
374
  begin
364
375
  v2 = r7.compute(@ruleopts_xyz, input)
@@ -366,12 +377,12 @@ module Marty::RuleSpec
366
377
  exp = 'no implicit conversion of Integer into String'
367
378
  expect(e.message).to include(exp)
368
379
  expres = [/DELOREAN__XyzRule_\d+_1483228800.0:23:in .+'/,
369
- /DELOREAN__XyzRule_\d+_1483228800.0:23:in .tmp_var4__D'/,
370
- /DELOREAN__XyzRule_\d+_1483228800.0:27:in .bv__D'/]
380
+ /DELOREAN__XyzRule_\d+_1483228800.0:23:in .tmp_var4__D'/,
381
+ /DELOREAN__XyzRule_\d+_1483228800.0:27:in .bv__D'/]
371
382
  expres.each_with_index do |expre, i|
372
383
  expect(e.backtrace[i]).to match(expre)
373
384
  end
374
- expect(e.input).to eq(input + {'dgparams__'=>input})
385
+ expect(e.input).to eq(input + { 'dgparams__' => input })
375
386
  expect(e.section).to eq('results')
376
387
  end
377
388
  begin
@@ -380,7 +391,7 @@ module Marty::RuleSpec
380
391
  exp = 'divided by 0'
381
392
  expect(e.message).to include(exp)
382
393
  expres = [%r(DELOREAN__XyzRule_\d+_1483228800.0:5:in ./'),
383
- /DELOREAN__XyzRule_\d+_1483228800.0:5:in .cg1__D'/]
394
+ /DELOREAN__XyzRule_\d+_1483228800.0:5:in .cg1__D'/]
384
395
  expres.each_with_index do |expre, i|
385
396
  expect(e.backtrace[i]).to match(expre)
386
397
  end
@@ -388,54 +399,54 @@ module Marty::RuleSpec
388
399
  expect(e.section).to eq('computed_guards')
389
400
  end
390
401
  log_ents = Marty::Log.all
391
- expect(log_ents.map{|le|le.message}).to eq(['Rule Log ZRule6',
392
- 'Rule Log ZRule7',
393
- 'Rule Log ZRule8'])
402
+ expect(log_ents.map(&:message)).to eq(['Rule Log ZRule6',
403
+ 'Rule Log ZRule7',
404
+ 'Rule Log ZRule8'])
394
405
  ptjson = pt.as_json
395
- exp = {"input"=>{"p1"=>12, "p2"=>3,
396
- "pt"=>ptjson,
397
- "flavor"=>"cherry"},
398
- "dgparams"=>{"p1"=>12, "p2"=>3,
399
- "pt"=>ptjson,
400
- "flavor"=>"cherry"},
401
- "gr_keys"=>["grid1_grid_result"],
402
- "res_hash"=>
403
- {"bv"=>"a stringa stringa stringa stringa stringa stringa stringa "\
404
- "stringa stringa stringa stringa stringa stringa stringa "\
405
- "stringa stringa stringa stringa stringa stringa stringa "\
406
- "stringa stringa stringa stringa string",
407
- "grid1_grid_result"=>19}}
406
+ exp = { 'input' => { 'p1' => 12, 'p2' => 3,
407
+ 'pt' => ptjson,
408
+ 'flavor' => 'cherry' },
409
+ 'dgparams' => { 'p1' => 12, 'p2' => 3,
410
+ 'pt' => ptjson,
411
+ 'flavor' => 'cherry' },
412
+ 'gr_keys' => ['grid1_grid_result'],
413
+ 'res_hash' =>
414
+ { 'bv' => 'a stringa stringa stringa stringa stringa stringa stringa '\
415
+ 'stringa stringa stringa stringa stringa stringa stringa '\
416
+ 'stringa stringa stringa stringa stringa stringa stringa '\
417
+ 'stringa stringa stringa stringa string',
418
+ 'grid1_grid_result' => 19 } }
408
419
  expect(log_ents[0].details).to eq(exp)
409
- exp = {"input"=>{"p1"=>12, "p2"=>3,
410
- "pt"=>ptjson,
411
- "flavor"=>"cherry"},
412
- "cg_hash"=>{"some_guard"=>true},
413
- "gr_keys"=>["grid1_grid_result"],
414
- "dgparams"=>{"p1"=>12, "p2"=>3,
415
- "pt"=>ptjson,
416
- "flavor"=>"cherry"},
417
- "res_keys"=>["bv", "grid1_grid_result"],
418
- "err_section"=>"results",
419
- "err_message"=>"no implicit conversion of Integer into String"}
420
+ exp = { 'input' => { 'p1' => 12, 'p2' => 3,
421
+ 'pt' => ptjson,
422
+ 'flavor' => 'cherry' },
423
+ 'cg_hash' => { 'some_guard' => true },
424
+ 'gr_keys' => ['grid1_grid_result'],
425
+ 'dgparams' => { 'p1' => 12, 'p2' => 3,
426
+ 'pt' => ptjson,
427
+ 'flavor' => 'cherry' },
428
+ 'res_keys' => ['bv', 'grid1_grid_result'],
429
+ 'err_section' => 'results',
430
+ 'err_message' => 'no implicit conversion of Integer into String' }
420
431
  expect(log_ents[1].details.except('err_stack')).to eq(exp)
421
432
  expres = [/DELOREAN__XyzRule_\d+_1483228800.0:23:in .+'/,
422
- /DELOREAN__XyzRule_\d+_1483228800.0:23:in .tmp_var4__D'/,
423
- /DELOREAN__XyzRule_\d+_1483228800.0:27:in .bv__D'/]
433
+ /DELOREAN__XyzRule_\d+_1483228800.0:23:in .tmp_var4__D'/,
434
+ /DELOREAN__XyzRule_\d+_1483228800.0:27:in .bv__D'/]
424
435
  expres.each_with_index do |expre, i|
425
436
  expect(log_ents[1].details['err_stack'][i]).to match(expre)
426
437
  end
427
- exp = {"input"=>{"p1"=>12, "p2"=>3,
428
- "pt"=>ptjson,
429
- "flavor"=>"cherry"},
430
- "cg_keys"=>["cg1"],
431
- "dgparams"=>{"p1"=>12, "p2"=>3,
432
- "pt"=>ptjson,
433
- "flavor"=>"cherry"},
434
- "err_section"=>"computed_guards",
435
- "err_message"=>"divided by 0"}
438
+ exp = { 'input' => { 'p1' => 12, 'p2' => 3,
439
+ 'pt' => ptjson,
440
+ 'flavor' => 'cherry' },
441
+ 'cg_keys' => ['cg1'],
442
+ 'dgparams' => { 'p1' => 12, 'p2' => 3,
443
+ 'pt' => ptjson,
444
+ 'flavor' => 'cherry' },
445
+ 'err_section' => 'computed_guards',
446
+ 'err_message' => 'divided by 0' }
436
447
  expect(log_ents[2].details.except('err_stack')).to eq(exp)
437
448
  expres = [%r(DELOREAN__XyzRule_\d+_1483228800.0:5:in ./'),
438
- /DELOREAN__XyzRule_\d+_1483228800.0:5:in .cg1__D'/]
449
+ /DELOREAN__XyzRule_\d+_1483228800.0:5:in .cg1__D'/]
439
450
  expres.each_with_index do |expre, i|
440
451
  expect(log_ents[2].details['err_stack'][i]).to match(expre)
441
452
  end