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
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
  require 'marty'
3
3
  require 'delorean_lang'
4
4
 
5
- CODE =<<EOS
5
+ CODE = <<EOS
6
6
  M:
7
7
  cfmt = {
8
8
  "type": ":cellIs",
@@ -83,26 +83,24 @@ M:
83
83
  format = "xlsx"
84
84
  EOS
85
85
 
86
-
87
86
  describe Marty::Xl do
88
-
89
- let(:engine) {
90
- Delorean::Engine.new "YYY"
91
- }
87
+ let(:engine) do
88
+ Delorean::Engine.new 'YYY'
89
+ end
92
90
 
93
91
  def worksheet(ind, c)
94
92
  code = CODE.clone
95
- map = {'C1' => c[0].to_s, 'C2' => c[1].to_s}
96
- map.each { |k,v| code.sub!(k,v) }
93
+ map = { 'C1' => c[0].to_s, 'C2' => c[1].to_s }
94
+ map.each { |k, v| code.sub!(k, v) }
97
95
  engine.parse(code)
98
- engine.evaluate("M", ["result"]).flatten(1)
96
+ engine.evaluate('M', ['result']).flatten(1)
99
97
  end
100
98
 
101
99
  before(:all) do
102
100
  @coords = [
103
- [[9, 5], [2, 5]], # coords for non-overlaping datasets
104
- [[5, 8], [2, 5]], # coords for overlaping datasets
105
- ]
101
+ [[9, 5], [2, 5]], # coords for non-overlaping datasets
102
+ [[5, 8], [2, 5]], # coords for overlaping datasets
103
+ ]
106
104
  end
107
105
 
108
106
  it "should be able to create a spreadsheet that includes multiple datasets that don't overlap " do
@@ -111,91 +109,91 @@ describe Marty::Xl do
111
109
  file = Tempfile.new('file.xlsx')
112
110
  lambda { sp.serialize(file) }.should_not raise_error()
113
111
 
114
- sp.workbook.worksheets[0].rows[0].cells[0..1].map { |c| c.value }.should ==
115
- ["Threshold", 5]
116
-
117
- sp.workbook.worksheets[0].rows[1].cells[0..1].map { |c| c.value }.should ==
118
- ["", ""]
112
+ sp.workbook.worksheets[0].rows[0].cells[0..1].map(&:value).should ==
113
+ ['Threshold', 5]
119
114
 
120
- sp.workbook.worksheets[0].rows[5].cells[0..15].map { |c| c.value }.should ==
121
- ["", "", "Sec Inst Name", "Market Change Sec Inst", "", "", "", "", "", "Sec Inst Name", "Market Change Sec Inst", "","", "", ""]
115
+ sp.workbook.worksheets[0].rows[1].cells[0..1].map(&:value).should ==
116
+ ['', '']
122
117
 
123
- sp.workbook.worksheets[0].rows[6].cells[0..15].map { |c| c.value }.should ==
124
- ["", "", "title", 2, 4, 5, 6, 8, "", "title", 2, 4, 5, 6, 8]
118
+ sp.workbook.worksheets[0].rows[5].cells[0..15].map(&:value).should ==
119
+ ['', '', 'Sec Inst Name', 'Market Change Sec Inst', '', '', '', '',
120
+ '', 'Sec Inst Name', 'Market Change Sec Inst', '', '', '', '']
125
121
 
126
- sp.workbook.worksheets[0].rows[7].cells[0..15].map { |c| c.value }.should ==
127
- ["", "", "text", 12, 4, 15, 6, 18, "", "text", 12, 4, 15, 6, 18]
122
+ sp.workbook.worksheets[0].rows[6].cells[0..15].map(&:value).should ==
123
+ ['', '', 'title', 2, 4, 5, 6, 8, '', 'title', 2, 4, 5, 6, 8]
128
124
 
129
- sp.workbook.worksheets[0].rows[8].cells[0..15].map { |c| c.value }.should ==
130
- ["", "", "text", 22, 4, 25, 6, 28, "", "text", 22, 4, 25, 6, 28]
125
+ sp.workbook.worksheets[0].rows[7].cells[0..15].map(&:value).should ==
126
+ ['', '', 'text', 12, 4, 15, 6, 18, '', 'text', 12, 4, 15, 6, 18]
131
127
 
132
- sp.workbook.worksheets[0].rows[9].cells[0..15].map { |c| c.value }.should ==
133
- ["", "", "text", 32, 4, 35, 6, 38, "", "text", 32, 4, 35, 6, 38]
128
+ sp.workbook.worksheets[0].rows[8].cells[0..15].map(&:value).should ==
129
+ ['', '', 'text', 22, 4, 25, 6, 28, '', 'text', 22, 4, 25, 6, 28]
134
130
 
135
- sp.workbook.worksheets[0].rows[10].cells[0..15].map { |c| c.value }.should ==
136
- ["", "", "text", 42, 4, 45, 6, 48, "", "text", 42, 4, 45, 6, 48]
131
+ sp.workbook.worksheets[0].rows[9].cells[0..15].map(&:value).should ==
132
+ ['', '', 'text', 32, 4, 35, 6, 38, '', 'text', 32, 4, 35, 6, 38]
137
133
 
138
- sp.workbook.worksheets[0].rows[11].cells[0..15].map { |c| c.value }.should ==
139
- ["", "", "text", 52, 4, 55, 6, 58, "", "text", 52, 4, 55, 6, 58]
134
+ sp.workbook.worksheets[0].rows[10].cells[0..15].map(&:value).should ==
135
+ ['', '', 'text', 42, 4, 45, 6, 48, '', 'text', 42, 4, 45, 6, 48]
140
136
 
141
- sp.workbook.worksheets[0].rows[12].cells[0..15].map { |c| c.value }.should ==
142
- ["", "", "text", 62, 4, 65, 6, 68, "", "text", 62, 4, 65, 6, 68]
137
+ sp.workbook.worksheets[0].rows[11].cells[0..15].map(&:value).should ==
138
+ ['', '', 'text', 52, 4, 55, 6, 58, '', 'text', 52, 4, 55, 6, 58]
143
139
 
144
- sp.workbook.worksheets[0].rows[13].cells[0..15].map { |c| c.value }.should ==
145
- ["", "", "text", 72, 4, 75, 6, 78, "", "text", 72, 4, 75, 6, 78]
140
+ sp.workbook.worksheets[0].rows[12].cells[0..15].map(&:value).should ==
141
+ ['', '', 'text', 62, 4, 65, 6, 68, '', 'text', 62, 4, 65, 6, 68]
146
142
 
143
+ sp.workbook.worksheets[0].rows[13].cells[0..15].map(&:value).should ==
144
+ ['', '', 'text', 72, 4, 75, 6, 78, '', 'text', 72, 4, 75, 6, 78]
147
145
  end
148
146
 
149
- it "should be able to create a spreadsheet that includes multiple datasets that overlap " do
147
+ it 'should be able to create a spreadsheet that includes multiple datasets that overlap ' do
150
148
  ws = worksheet(1, @coords[1])
151
149
  sp = Marty::Xl.spreadsheet(ws)
152
150
  file = Tempfile.new('file.xlsx')
153
151
  lambda { sp.serialize(file) }.should_not raise_error()
154
152
 
155
- sp.workbook.worksheets[0].rows[0].cells[0..1].map { |c| c.value }.should ==
156
- ["Threshold", 5]
153
+ sp.workbook.worksheets[0].rows[0].cells[0..1].map(&:value).should ==
154
+ ['Threshold', 5]
157
155
 
158
- sp.workbook.worksheets[0].rows[1].cells[0..1].map { |c| c.value }.should ==
159
- ["", ""]
156
+ sp.workbook.worksheets[0].rows[1].cells[0..1].map(&:value).should ==
157
+ ['', '']
160
158
 
161
- sp.workbook.worksheets[0].rows[5].cells[0..11].map { |c| c.value }.should ==
162
- ["", "", "Sec Inst Name", "Market Change Sec Inst", "", "", "", "", "", "", ""]
159
+ sp.workbook.worksheets[0].rows[5].cells[0..11].map(&:value).should ==
160
+ ['', '', 'Sec Inst Name', 'Market Change Sec Inst', '', '', '', '', '', '', '']
163
161
 
164
- sp.workbook.worksheets[0].rows[6].cells[0..11].map { |c| c.value }.should ==
165
- ["", "", "title", 2, 4, 5, 6, 8, "", "", ""]
162
+ sp.workbook.worksheets[0].rows[6].cells[0..11].map(&:value).should ==
163
+ ['', '', 'title', 2, 4, 5, 6, 8, '', '', '']
166
164
 
167
- sp.workbook.worksheets[0].rows[7].cells[0..11].map { |c| c.value }.should ==
168
- ["", "", "text", 12, 4, 15, 6, 18, "", "", ""]
165
+ sp.workbook.worksheets[0].rows[7].cells[0..11].map(&:value).should ==
166
+ ['', '', 'text', 12, 4, 15, 6, 18, '', '', '']
169
167
 
170
- sp.workbook.worksheets[0].rows[8].cells[0..11].map { |c| c.value }.should ==
171
- ["", "", "text", 22, 4, "Sec Inst Name", "Market Change Sec Inst", 28, "", "", ""]
168
+ sp.workbook.worksheets[0].rows[8].cells[0..11].map(&:value).should ==
169
+ ['', '', 'text', 22, 4, 'Sec Inst Name', 'Market Change Sec Inst', 28, '', '', '']
172
170
 
173
- sp.workbook.worksheets[0].rows[9].cells[0..11].map { |c| c.value }.should ==
174
- ["", "", "text", 32, 4, "title", 2, 4, 5, 6, 8]
171
+ sp.workbook.worksheets[0].rows[9].cells[0..11].map(&:value).should ==
172
+ ['', '', 'text', 32, 4, 'title', 2, 4, 5, 6, 8]
175
173
 
176
- sp.workbook.worksheets[0].rows[10].cells[0..11].map { |c| c.value }.should ==
177
- ["", "", "text", 42, 4, "text", 12, 4, 15, 6, 18]
174
+ sp.workbook.worksheets[0].rows[10].cells[0..11].map(&:value).should ==
175
+ ['', '', 'text', 42, 4, 'text', 12, 4, 15, 6, 18]
178
176
 
179
- sp.workbook.worksheets[0].rows[11].cells[0..11].map { |c| c.value }.should ==
180
- ["", "", "text", 52, 4, "text", 22, 4, 25, 6, 28]
177
+ sp.workbook.worksheets[0].rows[11].cells[0..11].map(&:value).should ==
178
+ ['', '', 'text', 52, 4, 'text', 22, 4, 25, 6, 28]
181
179
 
182
- sp.workbook.worksheets[0].rows[12].cells[0..11].map { |c| c.value }.should ==
183
- ["", "", "text", 62, 4, "text", 32, 4, 35, 6, 38]
180
+ sp.workbook.worksheets[0].rows[12].cells[0..11].map(&:value).should ==
181
+ ['', '', 'text', 62, 4, 'text', 32, 4, 35, 6, 38]
184
182
 
185
- sp.workbook.worksheets[0].rows[13].cells[0..11].map { |c| c.value }.should ==
186
- ["", "", "text", 72, 4, "text", 42, 4, 45, 6, 48]
183
+ sp.workbook.worksheets[0].rows[13].cells[0..11].map(&:value).should ==
184
+ ['', '', 'text', 72, 4, 'text', 42, 4, 45, 6, 48]
187
185
 
188
- sp.workbook.worksheets[0].rows[14].cells[0..11].map { |c| c.value }.should ==
189
- ["", "", "", "", "", "text", 52, 4, 55, 6, 58]
186
+ sp.workbook.worksheets[0].rows[14].cells[0..11].map(&:value).should ==
187
+ ['', '', '', '', '', 'text', 52, 4, 55, 6, 58]
190
188
 
191
- sp.workbook.worksheets[0].rows[15].cells[0..11].map { |c| c.value }.should ==
192
- ["", "", "", "", "", "text", 62, 4, 65, 6, 68]
189
+ sp.workbook.worksheets[0].rows[15].cells[0..11].map(&:value).should ==
190
+ ['', '', '', '', '', 'text', 62, 4, 65, 6, 68]
193
191
 
194
- sp.workbook.worksheets[0].rows[16].cells[0..11].map { |c| c.value }.should ==
195
- ["", "", "", "", "", "text", 72, 4, 75, 6, 78]
192
+ sp.workbook.worksheets[0].rows[16].cells[0..11].map(&:value).should ==
193
+ ['', '', '', '', '', 'text', 72, 4, 75, 6, 78]
196
194
  end
197
195
 
198
- it "should not raise an exception when given an empty, frozen arg" do
196
+ it 'should not raise an exception when given an empty, frozen arg' do
199
197
  data = [].freeze
200
198
  expect { Marty::Xl.spreadsheet(data).to_stream.read }.to_not raise_error
201
199
  end
@@ -2,8 +2,7 @@ require 'spec_helper'
2
2
  require 'marty'
3
3
  require 'delorean_lang'
4
4
 
5
-
6
- STYLE_CODE =<<EOS
5
+ STYLE_CODE = <<EOS
7
6
  S:
8
7
  data =
9
8
  [
@@ -35,18 +34,17 @@ S:
35
34
  EOS
36
35
 
37
36
  describe Marty::Xl do
38
-
39
- let(:engine) {
40
- Delorean::Engine.new "YYY"
41
- }
37
+ let(:engine) do
38
+ Delorean::Engine.new 'YYY'
39
+ end
42
40
 
43
41
  before(:each) do
44
42
  code = STYLE_CODE.clone
45
43
  engine.parse(code)
46
- @ws = engine.evaluate("S", ["result"]).flatten(1)
44
+ @ws = engine.evaluate('S', ['result']).flatten(1)
47
45
  end
48
46
 
49
- it "should be able to create a spreadsheet with overlapping border styles" do
47
+ it 'should be able to create a spreadsheet with overlapping border styles' do
50
48
  sp = Marty::Xl.spreadsheet(@ws)
51
49
  wb = sp.workbook
52
50
 
@@ -58,17 +56,17 @@ describe Marty::Xl do
58
56
  b.prs.each do |pr|
59
57
  edges << [pr.name, pr.style, pr.color.rgb]
60
58
  end
61
- edges.sort_by{ |k| k[0] }
59
+ edges.sort_by { |k| k[0] }
62
60
  end
63
61
 
64
- sp.workbook.worksheets[0].rows[0].cells[0..1].map { |c| c.value }.should ==
65
- ["", ""]
62
+ sp.workbook.worksheets[0].rows[0].cells[0..1].map(&:value).should ==
63
+ ['', '']
66
64
 
67
- sp.workbook.worksheets[0].rows[1].cells[0..2].map { |c| c.value }.should ==
68
- ["", 1, 2]
65
+ sp.workbook.worksheets[0].rows[1].cells[0..2].map(&:value).should ==
66
+ ['', 1, 2]
69
67
 
70
- sp.workbook.worksheets[0].rows[2].cells[0..2].map { |c| c.value }.should ==
71
- ["", 3, 4]
68
+ sp.workbook.worksheets[0].rows[2].cells[0..2].map(&:value).should ==
69
+ ['', 3, 4]
72
70
 
73
71
  wb.worksheets[0].styles.borders.count.should >= 4
74
72
 
@@ -79,11 +77,11 @@ describe Marty::Xl do
79
77
  when 0
80
78
  b.should == []
81
79
  when 2
82
- b.should == [[:left, :thin, "FF000000"]]
80
+ b.should == [[:left, :thin, 'FF000000']]
83
81
  when 3
84
- b.should == [[:top, :thick, "FFFF0000"]]
82
+ b.should == [[:top, :thick, 'FFFF0000']]
85
83
  when 4
86
- b.should == [[:left, :thin, "FF000000"], [:top, :thick, "FFFF0000"]]
84
+ b.should == [[:left, :thin, 'FF000000'], [:top, :thick, 'FFFF0000']]
87
85
  else
88
86
  next
89
87
  end
@@ -110,6 +108,5 @@ describe Marty::Xl do
110
108
  next
111
109
  end
112
110
  end
113
-
114
111
  end
115
112
  end
@@ -4,8 +4,8 @@ module Marty
4
4
  describe ApiAuth do
5
5
  before(:each) do
6
6
  Marty::Script.load_script_bodies({
7
- "Script1" => "A:\n a = 1\n",
8
- "NewScript1" => "B:\n b = 0\n",
7
+ 'Script1' => "A:\n a = 1\n",
8
+ 'NewScript1' => "B:\n b = 0\n",
9
9
  }, Date.today)
10
10
 
11
11
  @api = ApiAuth.new
@@ -16,11 +16,11 @@ module Marty
16
16
  end
17
17
 
18
18
  def create_params script, key
19
- {script: script, api_key: key}
19
+ { script: script, api_key: key }
20
20
  end
21
21
 
22
- describe "validations" do
23
- it "should require app name, api key and script name" do
22
+ describe 'validations' do
23
+ it 'should require app name, api key and script name' do
24
24
  api = ApiAuth.new
25
25
  expect(api).to_not be_valid
26
26
  expect(api.errors[:app_name].any?).to be_truthy
@@ -28,7 +28,7 @@ module Marty
28
28
  expect(api.errors[:script_name].any?).to be_truthy
29
29
  end
30
30
 
31
- it "should require unique app name/script name" do
31
+ it 'should require unique app name/script name' do
32
32
  api = @api.dup
33
33
  expect(api).to_not be_valid
34
34
  expect(api.errors[:app_name].to_s).to include('already been taken')
@@ -36,7 +36,7 @@ module Marty
36
36
  expect(api).to be_valid
37
37
  end
38
38
 
39
- it "should require unique api key/script name" do
39
+ it 'should require unique api key/script name' do
40
40
  api = @api.dup
41
41
  expect(api).to_not be_valid
42
42
  expect(api.errors[:api_key].to_s).to include('must be unique')
@@ -44,7 +44,7 @@ module Marty
44
44
  expect(api).to be_valid
45
45
  end
46
46
 
47
- it "should require a valid associated script name" do
47
+ it 'should require a valid associated script name' do
48
48
  api = ApiAuth.new
49
49
  api.app_name = 'NewApp'
50
50
  api.script_name = @api.script_name + 'Bad'
@@ -52,8 +52,8 @@ module Marty
52
52
  expect(api.errors[:base].to_s).to include('reference a valid script')
53
53
  end
54
54
 
55
- it "should allow a tagged script version to be associated when a DEV " +
56
- "version of that script also exists" do
55
+ it 'should allow a tagged script version to be associated when a DEV ' +
56
+ 'version of that script also exists' do
57
57
  s = Marty::Script.find_by(obsoleted_dt: 'infinity', name: 'Script1')
58
58
  s.body = "A:\n a = 3\n"
59
59
  s.save!
@@ -64,8 +64,8 @@ module Marty
64
64
  expect(api).to be_valid
65
65
  end
66
66
 
67
- it "should not allow a DEV script to be associated if there is no " +
68
- "tagged version of that script" do
67
+ it 'should not allow a DEV script to be associated if there is no ' +
68
+ 'tagged version of that script' do
69
69
  s = Marty::Script.new
70
70
  s.name = 'TestScript'
71
71
  s.body = '-- Test3'
@@ -81,16 +81,16 @@ module Marty
81
81
  end
82
82
  end
83
83
 
84
- describe "key management" do
85
- it "should require a 38 character key" do
84
+ describe 'key management' do
85
+ it 'should require a 38 character key' do
86
86
  expect(@api.api_key.length).to eq(38)
87
87
 
88
- @api.api_key = "123456789"
88
+ @api.api_key = '123456789'
89
89
  expect(@api).to_not be_valid
90
90
  expect(@api.errors[:base].to_s).to include('length must be 38')
91
91
  end
92
92
 
93
- it "should create the api key if necessary when the record is created" do
93
+ it 'should create the api key if necessary when the record is created' do
94
94
  a = ApiAuth.new
95
95
  a.app_name = 'MyApp'
96
96
  a.script_name = 'NewScript1'
@@ -99,7 +99,7 @@ module Marty
99
99
  expect(a.api_key).to_not be_nil
100
100
  end
101
101
 
102
- it "should allow api key to be updated for an existing record" do
102
+ it 'should allow api key to be updated for an existing record' do
103
103
  old = @api.api_key
104
104
  @api.api_key = ApiAuth.generate_key
105
105
  new = @api.api_key
@@ -110,7 +110,7 @@ module Marty
110
110
  expect(@api.api_key).to eq(new)
111
111
  end
112
112
 
113
- it "should generate new api key if old one is cleared" do
113
+ it 'should generate new api key if old one is cleared' do
114
114
  old = @api.api_key
115
115
  @api.api_key = ''
116
116
  @api.app_name += 'x'
@@ -118,7 +118,7 @@ module Marty
118
118
  expect(@api.api_key).to_not eq(old)
119
119
  end
120
120
 
121
- it "should generate new api key if old one is cleared (2)" do
121
+ it 'should generate new api key if old one is cleared (2)' do
122
122
  old = @api.api_key
123
123
  @api.api_key = nil
124
124
  @api.app_name += 'x'
@@ -127,21 +127,21 @@ module Marty
127
127
  end
128
128
  end
129
129
 
130
- describe "authorization" do
131
- it "should pass when script is not secured" do
130
+ describe 'authorization' do
131
+ it 'should pass when script is not secured' do
132
132
  # Script is not secured by any entries
133
- params = create_params('SomeScript','SomeKey')
133
+ params = create_params('SomeScript', 'SomeKey')
134
134
  expect(Marty::Api::Base.is_authorized?(params)).to be_truthy
135
135
  end
136
136
 
137
- it "should pass when script is secured and key is valid" do
137
+ it 'should pass when script is secured and key is valid' do
138
138
  expect(@api.script_name).to include('Script1')
139
139
 
140
140
  params = create_params(@api.script_name, @api.api_key)
141
141
  expect(Marty::Api::Base.is_authorized?(params)).to be_truthy
142
142
  end
143
143
 
144
- it "should pass when script is secured and key is valid 2" do
144
+ it 'should pass when script is secured and key is valid 2' do
145
145
  a = ApiAuth.new
146
146
  a.app_name = @api.app_name + 'x'
147
147
  a.script_name = 'NewScript1'
@@ -151,7 +151,7 @@ module Marty
151
151
  expect(Marty::Api::Base.is_authorized?(params)).to be_truthy
152
152
  end
153
153
 
154
- it "should match on exact script name" do
154
+ it 'should match on exact script name' do
155
155
  a = ApiAuth.new
156
156
  a.app_name = @api.app_name + 'x'
157
157
  a.script_name = 'NewScript1'
@@ -161,12 +161,12 @@ module Marty
161
161
  expect(Marty::Api::Base.is_authorized?(params)).to be_falsey
162
162
  end
163
163
 
164
- it "should fail when script is secured and key is invalid" do
164
+ it 'should fail when script is secured and key is invalid' do
165
165
  params = create_params('Script1', 'SomeKey')
166
166
  expect(Marty::Api::Base.is_authorized?(params)).to be_falsey
167
167
  end
168
168
 
169
- it "should fail when script is secured and key is invalid (2)" do
169
+ it 'should fail when script is secured and key is invalid (2)' do
170
170
  a = ApiAuth.new
171
171
  a.app_name = @api.app_name + 'x'
172
172
  a.script_name = 'NewScript1'
@@ -176,7 +176,7 @@ module Marty
176
176
  expect(Marty::Api::Base.is_authorized?(params)).to be_falsey
177
177
  end
178
178
 
179
- it "should fail when script is secured and key is not specified" do
179
+ it 'should fail when script is secured and key is not specified' do
180
180
  params = create_params('Script1', nil)
181
181
  expect(Marty::Api::Base.is_authorized?(params)).to be_falsey
182
182
 
@@ -184,7 +184,7 @@ module Marty
184
184
  expect(Marty::Api::Base.is_authorized?(params)).to be_falsey
185
185
  end
186
186
 
187
- it "should pass when api_auth is deleted and no other auths exist" do
187
+ it 'should pass when api_auth is deleted and no other auths exist' do
188
188
  params = create_params(@api.script_name, @api.api_key)
189
189
  expect(Marty::Api::Base.is_authorized?(params)).to be_truthy
190
190
  @api.delete
@@ -192,7 +192,7 @@ module Marty
192
192
  expect(Marty::Api::Base.is_authorized?(params)).to be_truthy
193
193
  end
194
194
 
195
- it "should fail when api_auth is deleted and another auth exists" do
195
+ it 'should fail when api_auth is deleted and another auth exists' do
196
196
  api = @api.dup
197
197
  api.app_name += 'x'
198
198
  api.api_key = nil