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
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- s1 =<<eof
3
+ s1 = <<eof
4
4
  NodeA:
5
5
  attr = 123
6
6
  eof
7
7
 
8
- s2 =<<eof
8
+ s2 = <<eof
9
9
  NodeB:
10
10
  attr = 456
11
11
  eof
@@ -22,7 +22,7 @@ describe Marty::Script do
22
22
  end
23
23
 
24
24
  it "doesn't create a new script entry if it already exists and is the " +
25
- "same as the existing" do
25
+ 'same as the existing' do
26
26
  Marty::Script.load_a_script('TestExistsAndSame', s1)
27
27
  expect { Marty::Script.load_a_script('TestExistsAndSame', s1) }.
28
28
  not_to change(Marty::Script, :count)
@@ -35,12 +35,16 @@ describe Marty::Script do
35
35
  to change(Marty::Script, :count).by(1)
36
36
 
37
37
  Marty::Script.load_a_script('TestExistsAndDifferent2', s1, now - 1.minute)
38
- expect { Marty::Script.load_a_script('TestExistsAndDifferent2',
39
- s2, now) }.
40
- to change { Marty::Script.where(name: 'TestExistsAndDifferent2',
41
- obsoleted_dt: 'infinity').count }.by(0)
38
+ expect do
39
+ Marty::Script.load_a_script('TestExistsAndDifferent2',
40
+ s2, now)
41
+ end.
42
+ to change {
43
+ Marty::Script.where(name: 'TestExistsAndDifferent2',
44
+ obsoleted_dt: 'infinity').count
45
+ } .by(0)
42
46
  expect(Marty::Script.find_by(
43
- obsoleted_dt: 'infinity', name: 'TestExistsAndDifferent2').
47
+ obsoleted_dt: 'infinity', name: 'TestExistsAndDifferent2').
44
48
  created_dt.to_s).to eq(now.to_s)
45
49
  end
46
50
  end
@@ -53,7 +57,7 @@ describe Marty::Script do
53
57
  let(:now) { Time.zone.now - 1.minute }
54
58
 
55
59
  it 'loads each script given a hash' do
56
- Marty::Script.load_script_bodies({'Test1' => s1, 'Test2' => s2}, now)
60
+ Marty::Script.load_script_bodies({ 'Test1' => s1, 'Test2' => s2 }, now)
57
61
  expect(Marty::Script).to have_received(:load_a_script).
58
62
  with('Test1', s1, now)
59
63
  expect(Marty::Script).to have_received(:load_a_script).
@@ -71,32 +75,38 @@ describe Marty::Script do
71
75
  end
72
76
 
73
77
  it 'creates a new tag if none exist yet with provided datetime' do
74
- expect { @tag = Marty::Script.load_script_bodies({'Test1' => s1,
75
- 'Test2' => s2}, now) }.
78
+ expect do
79
+ @tag = Marty::Script.load_script_bodies({ 'Test1' => s1,
80
+ 'Test2' => s2 }, now)
81
+ end.
76
82
  to change(Marty::Tag, :count).by(1)
77
83
  expect(@tag.created_dt).to eq(now + 1.second)
78
84
  end
79
85
 
80
86
  it 'creates a new tag when there is an older one present' do
81
87
  Marty::Tag.do_create(now - 1.minute, 'initial test tag')
82
- expect { @tag = Marty::Script.load_script_bodies({'Test1' => s1,
83
- 'Test2' => s2}, now) }.
88
+ expect do
89
+ @tag = Marty::Script.load_script_bodies({ 'Test1' => s1,
90
+ 'Test2' => s2 }, now)
91
+ end.
84
92
  to change(Marty::Tag, :count).by(1)
85
93
  expect(@tag.created_dt).to eq(now + 1.second)
86
94
  end
87
95
 
88
96
  it 'creates a new tag when no previous tag is present and no datetime ' +
89
97
  'provided' do
90
- expect { tag = Marty::Script.load_script_bodies({'Test1' => s1,
91
- 'Test2' => s2}) }.
98
+ expect do
99
+ tag = Marty::Script.load_script_bodies('Test1' => s1,
100
+ 'Test2' => s2)
101
+ end.
92
102
  to change(Marty::Tag, :count).by(1)
93
103
  end
94
104
 
95
105
  it "doesn't create a new tag if one is present and the script wasn't" +
96
- "modified" do
106
+ 'modified' do
97
107
  Marty::Script.create!(name: 'Test1', body: s1, created_dt: now)
98
108
  Marty::Tag.do_create(now + 1.second, 'tag created by test')
99
- expect { Marty::Script.load_script_bodies({'Test1' => s1}) }.
109
+ expect { Marty::Script.load_script_bodies('Test1' => s1) }.
100
110
  not_to change(Marty::Tag, :count)
101
111
  end
102
112
  end
@@ -118,7 +128,6 @@ describe Marty::Script do
118
128
  expect(Marty::Script).to have_received(:load_script_bodies).
119
129
  with(match_array([['Script1', ls1], ['Script2', ls2]]), now)
120
130
  end
121
-
122
131
  end
123
132
 
124
133
  describe '.get_script_filenames' do
@@ -7,12 +7,12 @@ module Marty
7
7
  system_user.login
8
8
  end
9
9
 
10
- let (:tuser) {
10
+ let (:tuser) do
11
11
  create_user('other_user')
12
- }
12
+ end
13
13
 
14
- describe "validations" do
15
- it "should require login, firstname and lastname" do
14
+ describe 'validations' do
15
+ it 'should require login, firstname and lastname' do
16
16
  user = User.new
17
17
  expect(user).to_not be_valid
18
18
  expect(user.errors[:login].any?).to be true
@@ -20,7 +20,7 @@ module Marty
20
20
  expect(user.errors[:lastname].any?).to be true
21
21
  end
22
22
 
23
- it "should require unique login" do
23
+ it 'should require unique login' do
24
24
  expect(Mcfly.whodunnit).to_not be_nil
25
25
  user = system_user.dup
26
26
  expect(user).to_not be_valid
@@ -29,7 +29,7 @@ module Marty
29
29
  expect(user).to be_valid
30
30
  end
31
31
 
32
- it "should not allow Gemini account to be de-activated" do
32
+ it 'should not allow Gemini account to be de-activated' do
33
33
  user = system_user
34
34
  user.active = false
35
35
  expect(user).to_not be_valid
@@ -37,13 +37,13 @@ module Marty
37
37
  to include('application system account cannot be deactivated')
38
38
  end
39
39
 
40
- it "should not allow accounts to be deleted" do
40
+ it 'should not allow accounts to be deleted' do
41
41
  user = system_user
42
42
  user.destroy
43
43
  expect(user.destroyed?).to be false
44
44
  end
45
45
 
46
- it "should not allow user managers to edit the Gemini account" do
46
+ it 'should not allow user managers to edit the Gemini account' do
47
47
  Mcfly.whodunnit = tuser
48
48
  user = system_user
49
49
  allow_any_instance_of(Marty::User).to receive(:user_manager_only).
@@ -54,7 +54,7 @@ module Marty
54
54
  to include('cannot edit the application system account')
55
55
  end
56
56
 
57
- it "should not allow user managers to edit their own account" do
57
+ it 'should not allow user managers to edit their own account' do
58
58
  Mcfly.whodunnit = tuser
59
59
  allow_any_instance_of(Marty::User).to receive(:user_manager_only).
60
60
  and_return(true)
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Marty::Diagnostic::Base do
4
- def sample_data consistent=true
5
- node_data_a = described_class.pack(include_ip=false){'A'}
6
- node_data_b = described_class.pack(include_ip=false){'B'}
4
+ def sample_data consistent = true
5
+ node_data_a = described_class.pack(include_ip = false) { 'A' }
6
+ node_data_b = described_class.pack(include_ip = false) { 'B' }
7
7
 
8
8
  data = {
9
9
  'NodeA' => node_data_a,
@@ -11,12 +11,13 @@ describe Marty::Diagnostic::Base do
11
11
  }
12
12
 
13
13
  return data if consistent
14
- data + {'NodeB' => node_data_b}
14
+
15
+ data + { 'NodeB' => node_data_b }
15
16
  end
16
17
 
17
18
  it 'determines consistency of aggregate diagnostics' do
18
19
  a = sample_data
19
- b = sample_data(consistent=false)
20
+ b = sample_data(consistent = false)
20
21
 
21
22
  expect(described_class.consistent?(a)).to eq(true)
22
23
  expect(described_class.consistent?(b)).to eq(false)
@@ -31,20 +32,20 @@ describe Marty::Diagnostic::Base do
31
32
  }
32
33
  }
33
34
 
34
- expect(described_class.pack(include_ip=false){'A'}).to eq(expected)
35
+ expect(described_class.pack(include_ip = false) { 'A' }).to eq(expected)
35
36
  end
36
37
 
37
38
  it 'can produce a valid diagnostic hash from a Hash' do
38
39
  test_a = {
39
40
  'ImportantA' => 'A',
40
41
  'ImportantB' => 'B',
41
- 'ImportantC' => 'C'}
42
+ 'ImportantC' => 'C' }
42
43
 
43
44
  test_b = {
44
45
  'ImportantA' => {
45
- 'description' => 'A', 'status' => true, 'consistent' => nil},
46
+ 'description' => 'A', 'status' => true, 'consistent' => nil },
46
47
  'ImportantB' => 'B',
47
- 'ImportantC' => 'C'}
48
+ 'ImportantC' => 'C' }
48
49
 
49
50
  expected = {
50
51
  'ImportantA' => {
@@ -59,21 +60,21 @@ describe Marty::Diagnostic::Base do
59
60
  }
60
61
 
61
62
  expect(described_class.
62
- pack(include_ip=false){test_a}).to eq(expected)
63
+ pack(include_ip = false) { test_a }).to eq(expected)
63
64
  expect(described_class.
64
- pack(include_ip=false){test_a}).to eq(expected)
65
+ pack(include_ip = false) { test_a }).to eq(expected)
65
66
  end
66
67
 
67
68
  it 'can produce a valid diagnostic hash from an error Hash' do
68
- test = described_class.pack(include_ip=false){
69
+ test = described_class.pack(include_ip = false) do
69
70
  described_class.error('E')
70
- }
71
+ end
71
72
 
72
73
  expected = {
73
- "Base"=>{
74
- "description"=>"E",
75
- "status"=>false,
76
- "consistent"=>nil}
74
+ 'Base' => {
75
+ 'description' => 'E',
76
+ 'status' => false,
77
+ 'consistent' => nil }
77
78
  }
78
79
 
79
80
  expect(test).to eq(expected)
@@ -96,7 +97,7 @@ describe Marty::Diagnostic::Base do
96
97
  }
97
98
  }
98
99
 
99
- expect{described_class.pack{test_a}}.to raise_error(RuntimeError)
100
- expect{described_class.pack{test_b}}.to raise_error(RuntimeError)
100
+ expect { described_class.pack { test_a } }.to raise_error(RuntimeError)
101
+ expect { described_class.pack { test_b } }.to raise_error(RuntimeError)
101
102
  end
102
103
  end
@@ -2,18 +2,19 @@ require 'spec_helper'
2
2
 
3
3
  describe Marty::Diagnostic::Collection do
4
4
  def sample_data consistent = true
5
- node_a_data = described_class.pack(include_ip=false){'A'}
5
+ node_a_data = described_class.pack(include_ip = false) { 'A' }
6
6
  data = {
7
7
  'NodeA' => node_a_data,
8
8
  'NodeB' => node_a_data,
9
9
  }
10
10
  return data if consistent
11
- data + {'NodeB' => {'Base' => described_class.error('B')}}
11
+
12
+ data + { 'NodeB' => { 'Base' => described_class.error('B') } }
12
13
  end
13
14
 
14
15
  it 'all diagnostics in diagnostics class attribute are generated' do
15
16
  diags = [Marty::Diagnostic::Version, Marty::Diagnostic::Nodes]
16
- expected = diags.map{|d| d.generate}.reduce(:deep_merge)
17
+ expected = diags.map(&:generate).reduce(:deep_merge)
17
18
  described_class.diagnostics = diags
18
19
  expect(described_class.generate).to eq(expected)
19
20
  end
@@ -21,9 +22,9 @@ describe Marty::Diagnostic::Collection do
21
22
  it 'declares data consistency via status consistency' do
22
23
  a = sample_data
23
24
  b = sample_data + {
24
- 'NodeB' => described_class.pack(include_ip=false){'B'}
25
+ 'NodeB' => described_class.pack(include_ip = false) { 'B' }
25
26
  }
26
- c = sample_data(consistent=false)
27
+ c = sample_data(consistent = false)
27
28
 
28
29
  expect(described_class.consistent?(a)).to eq(true)
29
30
  expect(described_class.consistent?(b)).to eq(true)
@@ -37,7 +37,7 @@ describe Marty::Diagnostic::DelayedJobVersion do
37
37
  it 'will fail if DELAYED_VER is not set' do
38
38
  ENV.delete('DELAYED_VER')
39
39
  start_delayed_job
40
- expect{described_class.generate}.to raise_error(RuntimeError)
40
+ expect { described_class.generate }.to raise_error(RuntimeError)
41
41
  stop_delayed_job
42
42
  end
43
43
  end
@@ -2,11 +2,11 @@ require 'spec_helper'
2
2
  require 'job_helper'
3
3
 
4
4
  describe Marty::Diagnostic::DelayedJobWorkers do
5
- def sample_data ip=nil, error=false
5
+ def sample_data ip = nil, error = false
6
6
  {
7
7
  ip || Marty::Helper.my_ip => {
8
8
  'Delayed Workers / Node' => {
9
- 'description' => error ? "3" : "4",
9
+ 'description' => error ? '3' : '4',
10
10
  'status' => true,
11
11
  'consistent' => nil
12
12
  },
@@ -14,12 +14,12 @@ describe Marty::Diagnostic::DelayedJobWorkers do
14
14
  }
15
15
  end
16
16
 
17
- def sample_aggregate error=false
17
+ def sample_aggregate error = false
18
18
  [
19
- sample_data(ip='0.0.0.0'),
20
- sample_data(ip='0.0.0.1'),
21
- sample_data(ip='0.0.0.2', error=error),
22
- sample_data(ip='0.0.0.3'),
19
+ sample_data(ip = '0.0.0.0'),
20
+ sample_data(ip = '0.0.0.1'),
21
+ sample_data(ip = '0.0.0.2', error = error),
22
+ sample_data(ip = '0.0.0.3'),
23
23
  ].reduce(:merge)
24
24
  end
25
25
 
@@ -31,7 +31,7 @@ describe Marty::Diagnostic::DelayedJobWorkers do
31
31
 
32
32
  it 'can determine if there are nodes with missing workers' do
33
33
  consistent = sample_aggregate
34
- inconsistent = sample_aggregate(error=true)
34
+ inconsistent = sample_aggregate(error = true)
35
35
 
36
36
  expect(described_class.consistent?(consistent)).to eq(true)
37
37
  expect(described_class.consistent?(inconsistent)).to eq(false)
@@ -7,19 +7,17 @@ describe Marty::Diagnostic::Reporter do
7
7
  attr_accessor :params, :port
8
8
  end
9
9
 
10
- def params diagnostic='base', scope=nil
11
- {op: diagnostic, scope: scope}
10
+ def params diagnostic = 'base', scope = nil
11
+ { op: diagnostic, scope: scope }
12
12
  end
13
13
 
14
14
  def git
15
- begin
16
15
  message = `cd #{Rails.root.to_s}; git describe --tags --always;`.strip
17
- rescue
18
- message = error("Failed accessing git")
19
- end
16
+ rescue StandardError
17
+ message = error('Failed accessing git')
20
18
  end
21
19
 
22
- def aggregate_data opts={}
20
+ def aggregate_data opts = {}
23
21
  {
24
22
  'Dummy' => {
25
23
  'NodeA' => {
@@ -33,7 +31,7 @@ describe Marty::Diagnostic::Reporter do
33
31
  }
34
32
  end
35
33
 
36
- def aggregate_consistency_data diagnostic='Base'
34
+ def aggregate_consistency_data diagnostic = 'Base'
37
35
  original_a = Marty::Diagnostic::Base.create_info('A')
38
36
  original_b = Marty::Diagnostic::Base.create_info('B')
39
37
 
@@ -75,12 +73,12 @@ describe Marty::Diagnostic::Reporter do
75
73
  expected = {
76
74
  diagnostic => {
77
75
  'NodeA' => {
78
- 'CONSTANTA' => original_a + {'consistent' => true},
76
+ 'CONSTANTA' => original_a + { 'consistent' => true },
79
77
  'CONSTANTB' => inconsistent_b,
80
78
  'CONSTANTB2' => inconsistent_b,
81
79
  },
82
80
  'NodeB' => {
83
- 'CONSTANTA' => original_a + {'consistent' => true},
81
+ 'CONSTANTA' => original_a + { 'consistent' => true },
84
82
  'CONSTANTB' => inconsistent_c,
85
83
  'CONSTANTB2' => inconsistent_c,
86
84
  },
@@ -95,18 +93,18 @@ describe Marty::Diagnostic::Reporter do
95
93
  end
96
94
 
97
95
  def version_data consistent = true
98
- Marty::Diagnostic::Base.pack(include_ip=false){
96
+ Marty::Diagnostic::Base.pack(include_ip = false) do
99
97
  {
100
- "Marty" => info(Marty::VERSION, true, consistent),
101
- "Delorean" => info(Delorean::VERSION, true, true),
102
- "Mcfly" => info(Mcfly::VERSION, true, true),
103
- "Git" => info(git, true, true),
98
+ 'Marty' => info(Marty::VERSION, true, consistent),
99
+ 'Delorean' => info(Delorean::VERSION, true, true),
100
+ 'Mcfly' => info(Mcfly::VERSION, true, true),
101
+ 'Git' => info(git, true, true),
104
102
  }
105
- }
103
+ end
106
104
  end
107
105
 
108
106
  def minimize(str)
109
- str.gsub(/\s+/, "")
107
+ str.gsub(/\s+/, '')
110
108
  end
111
109
 
112
110
  describe 'display mechanism for version diagnostic' do
@@ -119,7 +117,7 @@ describe Marty::Diagnostic::Reporter do
119
117
  end
120
118
 
121
119
  it 'masks consistent nodes for display (version)' do
122
- described_class.request.params = params(scope='local')
120
+ described_class.request.params = params(scope = 'local')
123
121
  data = {
124
122
  'Version' => {
125
123
  'NodeA' => version_data,
@@ -164,18 +162,18 @@ describe Marty::Diagnostic::Reporter do
164
162
 
165
163
  it 'displays all nodes when there is an inconsistent node (version)' do
166
164
  Marty:: Diagnostic::Reporter.request.params = params
167
- bad_ver = '0.0.0'
168
-
169
- data = {
170
- 'Version' => {
171
- 'NodeA' => version_data(consistent=false),
172
- 'NodeB' => version_data + {
173
- 'Marty' => Marty::Diagnostic::Base.create_info(bad_ver, true, false)
174
- },
175
- }
176
- }
177
-
178
- expected = <<-ERB
165
+ bad_ver = '0.0.0'
166
+
167
+ data = {
168
+ 'Version' => {
169
+ 'NodeA' => version_data(consistent = false),
170
+ 'NodeB' => version_data + {
171
+ 'Marty' => Marty::Diagnostic::Base.create_info(bad_ver, true, false)
172
+ },
173
+ }
174
+ }
175
+
176
+ expected = <<-ERB
179
177
  <h3>Version</h3>
180
178
  <h3 class="error">Inconsistency Detected </h3>
181
179
  <div class="wrapper">
@@ -207,10 +205,10 @@ describe Marty::Diagnostic::Reporter do
207
205
  </tr>
208
206
  </table>
209
207
  </div>
210
- ERB
208
+ ERB
211
209
 
212
- test = described_class.displays(data)
213
- expect(minimize(test)).to eq(minimize(expected))
210
+ test = described_class.displays(data)
211
+ expect(minimize(test)).to eq(minimize(expected))
214
212
  end
215
213
 
216
214
  it 'can detect errors in diagnostic for display and api' do