marty 2.4.0 → 2.4.1
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.
- checksums.yaml +5 -5
- data/Gemfile.lock +1 -1
- data/app/components/marty/api_auth_view.rb +4 -27
- data/app/components/marty/extras/layout.rb +7 -1
- data/app/components/marty/grid.rb +10 -9
- data/app/controllers/marty/rpc_controller.rb +4 -2
- data/app/models/marty/api_auth.rb +1 -80
- data/app/models/marty/api_config.rb +4 -4
- data/app/models/marty/delorean_rule.rb +2 -3
- data/config/routes.rb +1 -1
- data/db/migrate/{501_add_api_class_to_marty_api_config.rb → 500_add_api_class_to_marty_api_config.rb} +0 -0
- data/lib/marty/aws/base.rb +98 -0
- data/lib/marty/util.rb +15 -0
- data/lib/marty/version.rb +1 -1
- data/other/marty/api/base.rb +3 -0
- data/spec/controllers/job_controller_spec.rb +1 -1
- data/spec/dummy/app/components/gemini/xyz_rule_view.rb +0 -1
- data/spec/dummy/config/application.rb +0 -1
- data/spec/features/enum_spec.rb +100 -35
- data/spec/features/log_view_spec.rb +5 -5
- data/spec/features/rule_spec.rb +30 -30
- data/spec/features/user_view_spec.rb +2 -0
- data/spec/lib/logger_spec.rb +1 -1
- data/spec/models/event_spec.rb +1 -1
- data/spec/models/promise_spec.rb +1 -1
- data/spec/models/user_spec.rb +6 -6
- data/spec/spec_helper.rb +9 -69
- data/spec/support/chromedriver.rb +41 -0
- data/spec/support/components/netzke_combobox.rb +57 -0
- data/spec/support/components/netzke_grid.rb +356 -0
- data/spec/support/custom_matchers.rb +18 -0
- data/spec/support/custom_selectors.rb +49 -0
- data/spec/support/delayed_job_helpers.rb +4 -5
- data/spec/support/download_helper.rb +52 -0
- data/spec/support/helper.rb +20 -0
- data/spec/support/netzke.rb +306 -0
- data/spec/support/performance_helper.rb +26 -0
- data/spec/support/post_run_logger.rb +32 -0
- data/spec/support/{spec_setup.rb → setup.rb} +19 -6
- data/spec/support/shared_connection.rb +31 -0
- data/spec/support/{clean_db_helpers.rb → shared_connection_db_helpers.rb} +2 -2
- data/spec/support/structure_compare.rb +62 -0
- data/spec/support/suite.rb +27 -0
- data/spec/support/{integration_helpers.rb → users.rb} +11 -9
- metadata +20 -8
- data/db/migrate/502_add_parameters_to_marty_api_auth.rb +0 -5
- data/spec/support/user_helpers.rb +0 -12
@@ -15,7 +15,7 @@ describe Marty::JobController, slow: true do
|
|
15
15
|
|
16
16
|
# Needed here because shutting transactional fixtures off
|
17
17
|
# means we lose the globally set uesr
|
18
|
-
Mcfly.whodunnit =
|
18
|
+
Mcfly.whodunnit = system_user
|
19
19
|
|
20
20
|
Marty::Script.load_script_bodies(promise_bodies, Date.today)
|
21
21
|
|
data/spec/features/enum_spec.rb
CHANGED
@@ -14,6 +14,27 @@ feature 'test netzke + pg_enum compatibility', js: true do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'shows netzke grid combobox works w pg_enums' do
|
17
|
+
|
18
|
+
lp_grid = netzke_find('loan_program_view')
|
19
|
+
@amort_combo = netzke_find('amortization_type__name', 'combobox')
|
20
|
+
@mortgage_combo = netzke_find('mortgage_type__name', 'combobox')
|
21
|
+
@streamline_combo = netzke_find('streamline_type__name', 'combobox')
|
22
|
+
@state_combo = netzke_find('enum_state', 'combobox')
|
23
|
+
|
24
|
+
def setup_enum_form(stateVal)
|
25
|
+
@amort_combo.click
|
26
|
+
@amort_combo.select_values('Fixed')
|
27
|
+
|
28
|
+
@mortgage_combo.click
|
29
|
+
@mortgage_combo.select_values('FHA')
|
30
|
+
|
31
|
+
@streamline_combo.click
|
32
|
+
@streamline_combo.select_values('DURP')
|
33
|
+
|
34
|
+
@state_combo.click
|
35
|
+
@state_combo.select_values(stateVal)
|
36
|
+
end
|
37
|
+
|
17
38
|
log_in_as('dev1')
|
18
39
|
|
19
40
|
by 'navigating to loan program screen' do
|
@@ -21,11 +42,6 @@ feature 'test netzke + pg_enum compatibility', js: true do
|
|
21
42
|
press('Loan Programs')
|
22
43
|
end
|
23
44
|
|
24
|
-
lp_grid = netzke_find('loan_program_view')
|
25
|
-
amort_combo = netzke_find('amortization_type__name', 'combobox')
|
26
|
-
mortgage_combo = netzke_find('mortgage_type__name', 'combobox')
|
27
|
-
streamline_combo = netzke_find('streamline_type__name', 'combobox')
|
28
|
-
state_combo = netzke_find('enum_state', 'combobox')
|
29
45
|
|
30
46
|
and_by 'bring up new window' do
|
31
47
|
press('Add')
|
@@ -35,14 +51,14 @@ feature 'test netzke + pg_enum compatibility', js: true do
|
|
35
51
|
within(:gridpanel, 'add_window', match: :first) do
|
36
52
|
fill_in("Name", with: 'a_l_p')
|
37
53
|
|
38
|
-
amort_combo.click
|
39
|
-
amort_combo.select_values('Fixed')
|
54
|
+
@amort_combo.click
|
55
|
+
@amort_combo.select_values('Fixed')
|
40
56
|
|
41
|
-
mortgage_combo.click
|
42
|
-
mortgage_combo.select_values('FHA')
|
57
|
+
@mortgage_combo.click
|
58
|
+
@mortgage_combo.select_values('FHA')
|
43
59
|
|
44
|
-
streamline_combo.click
|
45
|
-
streamline_combo.select_values('DURP')
|
60
|
+
@streamline_combo.click
|
61
|
+
@streamline_combo.select_values('DURP')
|
46
62
|
|
47
63
|
press('OK')
|
48
64
|
end
|
@@ -58,18 +74,7 @@ feature 'test netzke + pg_enum compatibility', js: true do
|
|
58
74
|
and_by 'fill form w enum value & duplicated name (error), then fix' do
|
59
75
|
within(:gridpanel, 'add_window', match: :first) do
|
60
76
|
fill_in("Name", with: 'a_l_p')
|
61
|
-
|
62
|
-
amort_combo.select_values('Fixed')
|
63
|
-
|
64
|
-
mortgage_combo.click
|
65
|
-
mortgage_combo.select_values('FHA')
|
66
|
-
|
67
|
-
streamline_combo.click
|
68
|
-
streamline_combo.select_values('DURP')
|
69
|
-
|
70
|
-
state_combo.click
|
71
|
-
state_combo.select_values('CA')
|
72
|
-
|
77
|
+
setup_enum_form("CA")
|
73
78
|
press('OK')
|
74
79
|
|
75
80
|
expect(find(:msg)).to have_content 'Name - record must be unique'
|
@@ -100,18 +105,7 @@ feature 'test netzke + pg_enum compatibility', js: true do
|
|
100
105
|
and_by 'fill form w --- for enum value' do
|
101
106
|
within(:gridpanel, 'add_window', match: :first) do
|
102
107
|
fill_in("Name", with: 'a_l_p')
|
103
|
-
|
104
|
-
amort_combo.select_values('Fixed')
|
105
|
-
|
106
|
-
mortgage_combo.click
|
107
|
-
mortgage_combo.select_values('FHA')
|
108
|
-
|
109
|
-
streamline_combo.click
|
110
|
-
streamline_combo.select_values('DURP')
|
111
|
-
|
112
|
-
state_combo.click
|
113
|
-
state_combo.select_values('---')
|
114
|
-
|
108
|
+
setup_enum_form("---")
|
115
109
|
press('OK')
|
116
110
|
end
|
117
111
|
|
@@ -121,5 +115,76 @@ feature 'test netzke + pg_enum compatibility', js: true do
|
|
121
115
|
expect(lp_grid.get_row_vals(1)).to netzke_include({enum_state: nil})
|
122
116
|
end
|
123
117
|
end
|
118
|
+
|
119
|
+
and_by 'delete leftover rows' do
|
120
|
+
lp_grid.select_row(1)
|
121
|
+
press('Delete')
|
122
|
+
press('Yes')
|
123
|
+
wait_for_ajax
|
124
|
+
lp_grid.select_row(1)
|
125
|
+
press('Delete')
|
126
|
+
press('Yes')
|
127
|
+
wait_for_ajax
|
128
|
+
expect(lp_grid.row_count).to eq(0)
|
129
|
+
end
|
130
|
+
|
131
|
+
and_by "bring up new window" do
|
132
|
+
press("Add")
|
133
|
+
end
|
134
|
+
|
135
|
+
and_by "fill form with state_enum DC" do
|
136
|
+
within(:gridpanel, "add_window", match: :first) do
|
137
|
+
fill_in("Name", with: "DC Row")
|
138
|
+
setup_enum_form("DC")
|
139
|
+
press("OK")
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
and_by "bring up new window" do
|
144
|
+
press("Add")
|
145
|
+
end
|
146
|
+
|
147
|
+
and_by "fill form with state_enum AS" do
|
148
|
+
within(:gridpanel, "add_window", match: :first) do
|
149
|
+
fill_in("Name", with: "AS Row")
|
150
|
+
setup_enum_form("AS")
|
151
|
+
press("OK")
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
and_by "bring up new window" do
|
156
|
+
press("Add")
|
157
|
+
end
|
158
|
+
|
159
|
+
and_by "fill form with state_enum WA" do
|
160
|
+
within(:gridpanel, "add_window", match: :first) do
|
161
|
+
fill_in("Name", with: "WA Row")
|
162
|
+
setup_enum_form("WA")
|
163
|
+
press("OK")
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
and_by "bring up new window" do
|
168
|
+
press("Add")
|
169
|
+
end
|
170
|
+
|
171
|
+
and_by "fill form with state_enum AZ" do
|
172
|
+
within(:gridpanel, "add_window", match: :first) do
|
173
|
+
fill_in("Name", with: "AZ Row")
|
174
|
+
setup_enum_form("AZ")
|
175
|
+
press("OK")
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
and_by "filter form by state_enum ASCENDING" do
|
180
|
+
press("Enum state")
|
181
|
+
expect(lp_grid.get_col_vals(:enum_state)).to eq(["AS","AZ","DC","WA"])
|
182
|
+
end
|
183
|
+
|
184
|
+
and_by "filter form by state_enum DESCENDING" do
|
185
|
+
press("Enum state")
|
186
|
+
expect(lp_grid.get_col_vals(:enum_state)).to eq(["WA","DC","AZ","AS"])
|
187
|
+
end
|
188
|
+
|
124
189
|
end
|
125
190
|
end
|
@@ -45,7 +45,7 @@ feature 'logger view', js: true, capybara: true do
|
|
45
45
|
press('System')
|
46
46
|
show_submenu('Log Maintenance')
|
47
47
|
press('View Log')
|
48
|
-
|
48
|
+
wait_for_ajax
|
49
49
|
|
50
50
|
exp_types = ["fatal", "error", "info", "debug", "warn"]
|
51
51
|
exp_messages = ["fatal message", "error message",
|
@@ -72,11 +72,11 @@ feature 'logger view', js: true, capybara: true do
|
|
72
72
|
wait_for_ajax
|
73
73
|
cnt = logview.row_count()
|
74
74
|
expect(cnt).to eq(exp_count)
|
75
|
-
types = logview.
|
76
|
-
messages = logview.
|
77
|
-
details = logview.
|
75
|
+
types = logview.get_col_vals('message_type', cnt, 0)
|
76
|
+
messages = logview.get_col_vals('message', cnt, 0)
|
77
|
+
details = logview.get_col_vals('details', cnt, 0).
|
78
78
|
map { |d| CGI.unescapeHTML(d) }
|
79
|
-
ts = logview.
|
79
|
+
ts = logview.get_col_vals('timestamp_custom', cnt, 0)
|
80
80
|
expect(ts).to eq(@ts.slice(0,exp_count))
|
81
81
|
expect(types).to eq(exp_types.slice(0,exp_count))
|
82
82
|
expect(messages).to eq(exp_messages.slice(0,exp_count))
|
data/spec/features/rule_spec.rb
CHANGED
@@ -200,7 +200,7 @@ feature 'rule view', js: true do
|
|
200
200
|
exp = "Computed - Error in rule 'abc' field 'computed_guards': Syntax error on line 1"
|
201
201
|
expect(page).to have_content(exp)
|
202
202
|
sleep 2 # sleep needed for message to clear, otherwise failing tests could
|
203
|
-
|
203
|
+
# pass due to prior messages
|
204
204
|
|
205
205
|
# lhs is not identifier - BaseRuleView#simple_to_has will raise
|
206
206
|
fill_in(:computed_guards, with: '0sadf = 123j')
|
@@ -307,7 +307,7 @@ computed_value = if paramb
|
|
307
307
|
then param1 / (grid1_grid_result||1)
|
308
308
|
else (grid2_grid_result||1) / param1
|
309
309
|
EOL
|
310
|
-
names = mrv.
|
310
|
+
names = mrv.get_col_vals(:name, 9, 0)
|
311
311
|
idx = names.index{|n|n=='Rule3'}+1
|
312
312
|
mrv.select_row(idx)
|
313
313
|
press("Edit")
|
@@ -326,9 +326,9 @@ EOL
|
|
326
326
|
go_to_xyz_rules
|
327
327
|
xrv = netzke_find("xyz_rule_view")
|
328
328
|
expect(page).to have_content("Rule type")
|
329
|
-
expect(xrv.
|
330
|
-
|
331
|
-
|
329
|
+
expect(xrv.get_col_vals(:name, 5, 0)).to eq(["ZRule1", "ZRule2",
|
330
|
+
"ZRule3", "ZRule4",
|
331
|
+
"ZRule5"])
|
332
332
|
xrv.select_row(1)
|
333
333
|
press("Edit")
|
334
334
|
fill_in("Range Guard 1", with: "[100,200)")
|
@@ -359,37 +359,37 @@ EOL
|
|
359
359
|
"bv"=>"base_value"}}
|
360
360
|
|
361
361
|
expect(r.first.as_json).to include(exp)
|
362
|
-
expect(xrv.
|
363
|
-
|
362
|
+
expect(xrv.get_col_vals(:g_string, 8, 0)).to eq(["aaa", "bbb", "ccc", "ddd",
|
363
|
+
"eee", "eee", "eee", "eee"])
|
364
364
|
click_column(xrv, "String list Guard")
|
365
|
-
expect(xrv.
|
366
|
-
|
365
|
+
expect(xrv.get_col_vals(:g_string, 8, 0)).to eq(["eee", "eee", "eee", "eee",
|
366
|
+
"ddd", "ccc", "bbb", "aaa"])
|
367
367
|
column_filter(xrv, "String list Guard", "eee")
|
368
368
|
rc = xrv.row_count
|
369
|
-
expect(xrv.
|
369
|
+
expect(xrv.get_col_vals(:g_string,rc,0)).to eq(["eee", "eee", "eee", "eee"])
|
370
370
|
column_filter_toggle(xrv, "String list Guard")
|
371
371
|
rc = xrv.row_count
|
372
|
-
expect(xrv.
|
373
|
-
|
372
|
+
expect(xrv.get_col_vals(:g_string,rc,0)).to eq(["eee", "eee", "eee", "eee",
|
373
|
+
"ddd", "ccc", "bbb", "aaa"])
|
374
374
|
column_filter(xrv, "Grids", "Grid1")
|
375
375
|
rc = xrv.row_count
|
376
|
-
|
377
|
-
expect(xrv.
|
378
|
-
|
376
|
+
# netzke reports jsonb as string
|
377
|
+
expect(xrv.get_col_vals(:grids,rc,0)).to eq([%Q({"grid1":"DataGrid1"}),
|
378
|
+
%Q({"grid1":"DataGrid1"})])
|
379
379
|
column_filter_toggle(xrv, "Grids")
|
380
380
|
rc = xrv.row_count
|
381
|
-
expect(xrv.
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
381
|
+
expect(xrv.get_col_vals(:grids,rc,0)).to eq([%Q({"grid1":"DataGrid3"}),
|
382
|
+
%Q({"grid1":"DataGrid3"}),
|
383
|
+
%Q({"grid1":"DataGrid3"}),
|
384
|
+
%Q({"grid1":"DataGrid3"}),
|
385
|
+
%Q({"grid1":"DataGrid3"}),
|
386
|
+
%Q({"grid1":"DataGrid2"}),
|
387
|
+
%Q({"grid1":"DataGrid1"}),
|
388
|
+
%Q({"grid1":"DataGrid1"})])
|
389
389
|
press("Applications")
|
390
390
|
press("Data Grids")
|
391
391
|
dgv = netzke_find("data_grid_view")
|
392
|
-
cvs = dgv.
|
392
|
+
cvs = dgv.get_col_vals(:name, 4, 0)
|
393
393
|
ind1 = cvs.index("DataGrid1")+1
|
394
394
|
ind4 = cvs.index("DataGrid4")+1
|
395
395
|
dgv.select_row(ind1)
|
@@ -406,8 +406,8 @@ EOL
|
|
406
406
|
go_to_xyz_rules
|
407
407
|
wait_for_ajax
|
408
408
|
|
409
|
-
names = xrv.
|
410
|
-
gvs = xrv.
|
409
|
+
names = xrv.get_col_vals(:name, 5, 0)
|
410
|
+
gvs = xrv.get_col_vals(:grids, 5, 0)
|
411
411
|
g1h = {"grid1"=>"DataGrid1 new"}
|
412
412
|
expect(JSON.parse(gvs[names.index("ZRule1")])).to eq(g1h)
|
413
413
|
expect(JSON.parse(gvs[names.index("ZRule2")])).to eq(g1h)
|
@@ -415,14 +415,14 @@ EOL
|
|
415
415
|
go_to_my_rules
|
416
416
|
wait_for_ajax
|
417
417
|
|
418
|
-
names = mrv.
|
419
|
-
gvs = mrv.
|
420
|
-
rvs = mrv.
|
418
|
+
names = mrv.get_col_vals(:name, 9, 0)
|
419
|
+
gvs = mrv.get_col_vals(:grids, 9, 0)
|
420
|
+
rvs = mrv.get_col_vals(:results, 9, 0)
|
421
421
|
expect(JSON.parse(gvs[names.index('abc')])).to eq(g1h)
|
422
422
|
expect(JSON.parse(gvs[names.index('Rule2b')])).to eq(g1h +
|
423
423
|
{"grid2"=>"DataGrid2"})
|
424
424
|
expect(JSON.parse(rvs[names.index('Rule5')])["other_grid"]).to eq(
|
425
|
-
|
425
|
+
'"DataGrid4 new"')
|
426
426
|
|
427
427
|
end
|
428
428
|
end
|
data/spec/lib/logger_spec.rb
CHANGED
@@ -68,7 +68,7 @@ module Marty
|
|
68
68
|
|
69
69
|
# Needed here because shutting transactional fixtures off
|
70
70
|
# means we lose the globally set user
|
71
|
-
Mcfly.whodunnit =
|
71
|
+
Mcfly.whodunnit = system_user
|
72
72
|
|
73
73
|
Marty::Script.load_script_bodies(promise_bodies, Date.today)
|
74
74
|
start_delayed_job
|
data/spec/models/event_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe Marty::Event do
|
|
12
12
|
|
13
13
|
# Needed here because shutting transactional fixtures off
|
14
14
|
# means we lose the globally set user
|
15
|
-
Mcfly.whodunnit =
|
15
|
+
Mcfly.whodunnit = system_user
|
16
16
|
|
17
17
|
Marty::Script.load_script_bodies(promise_bodies, Date.today)
|
18
18
|
start_delayed_job
|
data/spec/models/promise_spec.rb
CHANGED
@@ -10,7 +10,7 @@ describe Marty::Promise, slow: true do
|
|
10
10
|
|
11
11
|
# Needed here because shutting transactional fixtures off
|
12
12
|
# means we lose the globally set user
|
13
|
-
Mcfly.whodunnit =
|
13
|
+
Mcfly.whodunnit = system_user
|
14
14
|
|
15
15
|
Marty::Script.load_script_bodies(promise_bodies, Date.today)
|
16
16
|
|
data/spec/models/user_spec.rb
CHANGED
@@ -4,11 +4,11 @@ module Marty
|
|
4
4
|
describe User do
|
5
5
|
before(:each) do
|
6
6
|
Rails.configuration.marty.system_account =
|
7
|
-
|
7
|
+
system_user.login
|
8
8
|
end
|
9
9
|
|
10
10
|
let (:tuser) {
|
11
|
-
|
11
|
+
create_user('other_user')
|
12
12
|
}
|
13
13
|
|
14
14
|
describe "validations" do
|
@@ -22,7 +22,7 @@ module Marty
|
|
22
22
|
|
23
23
|
it "should require unique login" do
|
24
24
|
expect(Mcfly.whodunnit).to_not be_nil
|
25
|
-
user =
|
25
|
+
user = system_user.dup
|
26
26
|
expect(user).to_not be_valid
|
27
27
|
expect(user.errors[:login].to_s).to include('already been taken')
|
28
28
|
user.login = 'marty2'
|
@@ -30,7 +30,7 @@ module Marty
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should not allow Gemini account to be de-activated" do
|
33
|
-
user =
|
33
|
+
user = system_user
|
34
34
|
user.active = false
|
35
35
|
expect(user).to_not be_valid
|
36
36
|
expect(user.errors[:base].to_s).
|
@@ -38,14 +38,14 @@ module Marty
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should not allow accounts to be deleted" do
|
41
|
-
user =
|
41
|
+
user = system_user
|
42
42
|
user.destroy
|
43
43
|
expect(user.destroyed?).to be false
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should not allow user managers to edit the Gemini account" do
|
47
47
|
Mcfly.whodunnit = tuser
|
48
|
-
user =
|
48
|
+
user = system_user
|
49
49
|
allow_any_instance_of(Marty::User).to receive(:user_manager_only).
|
50
50
|
and_return(true)
|
51
51
|
user.firstname = 'Testing'
|
data/spec/spec_helper.rb
CHANGED
@@ -3,67 +3,22 @@ ENV["RAILS_ENV"] ||= "test"
|
|
3
3
|
require 'dummy/config/application'
|
4
4
|
require 'rspec/rails'
|
5
5
|
require 'database_cleaner'
|
6
|
-
|
6
|
+
|
7
|
+
support = Pathname.new(__FILE__).parent.to_s + '/support'
|
8
|
+
require "#{support}/suite"
|
9
|
+
require "#{support}/shared_connection"
|
7
10
|
|
8
11
|
Dummy::Application.initialize! unless Dummy::Application.initialized?
|
9
12
|
|
10
13
|
ActiveRecord::Migrator.migrate File.expand_path("../../db/migrate/", __FILE__)
|
11
14
|
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
|
12
15
|
|
13
|
-
Dir[Rails.root.join("../support/**/*.rb")].each { |f| require f }
|
14
|
-
|
15
|
-
def register_chrome_driver driver = :chrome, options={}
|
16
|
-
Capybara.register_driver driver do |app|
|
17
|
-
caps = Selenium::WebDriver::Remote::Capabilities.
|
18
|
-
chrome(options + {pageLoadStrategy: 'none'})
|
19
|
-
|
20
|
-
Capybara::Selenium::Driver.new(app,
|
21
|
-
browser: :chrome,
|
22
|
-
desired_capabilities: caps)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
CLASSES_TO_EXCLUDE_FROM_SHARED = ["Marty::Log"]
|
27
|
-
class ActiveRecord::Base
|
28
|
-
mattr_accessor :shared_connection
|
29
|
-
class << self
|
30
|
-
alias_method :orig_connection, :connection
|
31
|
-
end
|
32
|
-
def self.clear_connection
|
33
|
-
@@shared_connection = nil
|
34
|
-
end
|
35
|
-
|
36
|
-
clear_connection
|
37
|
-
|
38
|
-
def self.connection
|
39
|
-
CLASSES_TO_EXCLUDE_FROM_SHARED.include?(model_name) ? orig_connection :
|
40
|
-
@@shared_connection ||
|
41
|
-
ConnectionPool::Wrapper.new(:size => 1) {retrieve_connection}
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.reset_shared_connection
|
45
|
-
@@shared_connection = ConnectionPool::Wrapper.
|
46
|
-
new(:size => 1) {retrieve_connection}
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
register_chrome_driver(:chrome, chromeOptions: { args: %w[start-maximized]})
|
51
|
-
register_chrome_driver(:headless,
|
52
|
-
chromeOptions: {
|
53
|
-
args: %w[headless disable-gpu window-size=3840,2160]
|
54
|
-
})
|
55
|
-
|
56
|
-
Capybara.javascript_driver = ENV['HEADLESS'] == 'true' ? :headless : :chrome
|
57
|
-
|
58
|
-
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
|
59
|
-
|
60
16
|
RSpec.configure do |config|
|
61
|
-
config.include
|
62
|
-
config.include
|
63
|
-
config.include
|
64
|
-
config.include Marty::IntegrationHelpers
|
65
|
-
config.include MartyRSpec::Util
|
17
|
+
config.include Marty::RSpec::Suite
|
18
|
+
config.include Marty::RSpec::SharedConnection
|
19
|
+
config.include Marty::RSpec::SharedConnectionDbHelpers
|
66
20
|
|
21
|
+
#RspecMarty::SharedConnection.classes_to_exclude_shared = ['Marty::Log']
|
67
22
|
Capybara.default_max_wait_time = 3
|
68
23
|
|
69
24
|
# TODO: Continue to remove should syntax from specs - remove this line to see
|
@@ -83,7 +38,7 @@ RSpec.configure do |config|
|
|
83
38
|
end
|
84
39
|
|
85
40
|
config.before(:each) do
|
86
|
-
|
41
|
+
marty_whodunnit
|
87
42
|
end
|
88
43
|
|
89
44
|
config.after(:each, :js => true) do |example|
|
@@ -102,19 +57,4 @@ RSpec.configure do |config|
|
|
102
57
|
config.use_transactional_fixtures = true
|
103
58
|
|
104
59
|
Netzke::Testing.rspec_init(config)
|
105
|
-
|
106
|
-
# FIXME: temporary monkey patch to fix marty_rspec for new extjs/rails
|
107
|
-
module MartyRSpec
|
108
|
-
module Components
|
109
|
-
class NetzkeGrid
|
110
|
-
def get_row_vals row
|
111
|
-
res = run_js <<-JS
|
112
|
-
#{ext_var(grid, 'grid')}
|
113
|
-
return Ext.encode(#{ext_row(row.to_i - 1, 'grid')}.data);
|
114
|
-
JS
|
115
|
-
JSON.parse(res)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
60
|
end
|