rules_engine 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rules_engine/process/auditor/db_auditor.rb +1 -0
- data/lib/rules_engine/rule/outcome.rb +1 -0
- data/rails_generators/manifests/complex.rb +4 -1
- data/rails_generators/manifests/complex.yml +0 -1
- data/rails_generators/manifests/rules_engine.rb +15 -2
- data/rails_generators/manifests/rules_engine.yml +0 -2
- data/rails_generators/manifests/simple.rb +4 -1
- data/rails_generators/manifests/simple.yml +0 -1
- data/rails_generators/templates/app/controllers/re_plan_workflows_controller.rb +30 -5
- data/rails_generators/templates/app/controllers/re_plans_controller.rb +26 -2
- data/rails_generators/templates/app/controllers/re_workflows_controller.rb +27 -2
- data/rails_generators/templates/app/models/re_rule.rb +0 -30
- data/rails_generators/templates/app/rules/complex.rb +3 -3
- data/rails_generators/templates/app/views/re_plan_workflows/change.html.erb +6 -2
- data/rails_generators/templates/app/views/re_plan_workflows/copy.html.erb +12 -0
- data/rails_generators/templates/app/views/re_plan_workflows/copy.js.erb +8 -0
- data/rails_generators/templates/app/views/re_plan_workflows/new.js.erb +5 -1
- data/rails_generators/templates/app/views/re_plan_workflows/show.html.erb +3 -2
- data/rails_generators/templates/app/views/re_plans/_copy.html.erb +18 -0
- data/rails_generators/templates/app/views/re_plans/_preview.html.erb +1 -1
- data/rails_generators/templates/app/views/re_plans/_workflow_preview.html.erb +1 -3
- data/rails_generators/templates/app/views/re_plans/change.html.erb +6 -0
- data/rails_generators/templates/app/views/re_plans/copy.html.erb +11 -0
- data/rails_generators/templates/app/views/re_plans/copy.js.erb +9 -0
- data/rails_generators/templates/app/views/re_plans/new.js.erb +4 -1
- data/rails_generators/templates/app/views/re_plans/show.html.erb +1 -1
- data/rails_generators/templates/app/views/re_rule_definitions/complex/_form.html.erb +2 -2
- data/rails_generators/templates/app/views/re_rule_definitions/simple/_form.html.erb +1 -1
- data/rails_generators/templates/app/views/re_workflows/_copy.html.erb +21 -0
- data/rails_generators/templates/app/views/re_workflows/_rule_change.html.erb +11 -14
- data/rails_generators/templates/app/views/re_workflows/_rule_preview.html.erb +14 -17
- data/rails_generators/templates/app/views/re_workflows/_rule_show.html.erb +13 -16
- data/rails_generators/templates/app/views/re_workflows/_show.html.erb +1 -3
- data/rails_generators/templates/app/views/re_workflows/change.html.erb +5 -0
- data/rails_generators/templates/app/views/re_workflows/copy.html.erb +11 -0
- data/rails_generators/templates/app/views/re_workflows/copy.js.erb +8 -0
- data/rails_generators/templates/app/views/re_workflows/index.html.erb +1 -1
- data/rails_generators/templates/app/views/re_workflows/preview.html.erb +1 -0
- data/rails_generators/templates/app/views/re_workflows/show.html.erb +3 -2
- data/rails_generators/templates/app/views/re_workflows/update.js.erb +1 -1
- data/rails_generators/templates/db/migrate/20100308225008_create_rules_engine.rb +0 -13
- data/rails_generators/templates/doc/README.rules_engine +7 -6
- data/rails_generators/templates/lib/tasks/rules_engine.rake +2 -2
- data/rails_generators/templates/public/javascripts/rules_engine/re_plan_change.js +20 -0
- data/rails_generators/templates/public/javascripts/rules_engine/re_plan_new.js +2 -8
- data/rails_generators/templates/public/javascripts/rules_engine/re_workflow_add.js +3 -12
- data/rails_generators/templates/public/javascripts/rules_engine/re_workflow_change.js +23 -4
- data/rails_generators/templates/public/javascripts/rules_engine/re_workflow_new.js +2 -8
- data/rails_generators/templates/public/javascripts/rules_engine/re_workflow_show.js +22 -0
- data/rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_plan/copy-25.png +0 -0
- data/rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/re_workflow/copy-25.png +0 -0
- data/rails_generators/templates/public/stylesheets/rules_engine/screen.css +52 -1
- data/rails_generators/templates/spec/lib/rules/complex_spec.rb +46 -41
- data/rails_generators/templates/spec/lib/rules/simple_spec.rb +41 -35
- data/rails_generators/templates/spec/models/re_rule_spec.rb +12 -74
- metadata +15 -6
- data/rails_generators/templates/app/models/re_rule_expected_outcome.rb +0 -14
- data/rails_generators/templates/spec/models/re_rule_expected_outcome_spec.rb +0 -29
@@ -15,8 +15,8 @@ task :rules_engine do
|
|
15
15
|
|
16
16
|
RulesEngine::Publish.publisher = :db_publisher
|
17
17
|
RulesEngine::Process.runner = :db_runner
|
18
|
-
RulesEngine::Process.auditor = :db_auditor
|
19
|
-
RulesEngine::Process.auditor.audit_level = RulesEngine::Process::AUDIT_INFO
|
18
|
+
# RulesEngine::Process.auditor = :db_auditor
|
19
|
+
# RulesEngine::Process.auditor.audit_level = RulesEngine::Process::AUDIT_INFO
|
20
20
|
RulesEngine::Discovery.rules_path = File.expand_path(File.join(File.dirname(__FILE__), '/../../app/rules'))
|
21
21
|
RulesEngine::Discovery.discover!
|
22
22
|
|
@@ -11,6 +11,26 @@ re_plan_action_confirm = function(id, title, action) {
|
|
11
11
|
|
12
12
|
$(document).ready(function() {
|
13
13
|
|
14
|
+
$('a#re_plan_copy').live('click', function() {
|
15
|
+
var plan = $(this).attr('href').replace('#', '');
|
16
|
+
|
17
|
+
$.re_block();
|
18
|
+
$.get('/re_plans/' + plan + '/copy', null, null, 'script');
|
19
|
+
return false;
|
20
|
+
});
|
21
|
+
|
22
|
+
$("#re_plan_copy_cancel").live('click', function() {
|
23
|
+
$.fancybox.close();
|
24
|
+
return false;
|
25
|
+
});
|
26
|
+
|
27
|
+
$('#re_plan_copy_duplicate').live('click', function() {
|
28
|
+
$.re_block();
|
29
|
+
$.post($('#re_plan_copy_form').attr('action'), $('#re_plan_copy_form').serialize(), null, 'script');
|
30
|
+
return false;
|
31
|
+
});
|
32
|
+
|
33
|
+
|
14
34
|
$('a#re_plan_edit').live('click', function() {
|
15
35
|
var plan = $(this).attr('href').replace('#', '');
|
16
36
|
|
@@ -2,10 +2,7 @@ $(document).ready(function() {
|
|
2
2
|
|
3
3
|
$('a#re_plan_new').live('click', function() {
|
4
4
|
$.re_block();
|
5
|
-
$.get('/re_plans/new', null,
|
6
|
-
$.re_unblock();
|
7
|
-
$.fancybox({ href: '#re_content'});
|
8
|
-
}, 'script');
|
5
|
+
$.get('/re_plans/new', null, null, 'script');
|
9
6
|
return false;
|
10
7
|
});
|
11
8
|
|
@@ -17,10 +14,7 @@ $(document).ready(function() {
|
|
17
14
|
|
18
15
|
$('#re_plan_new_insert').live('click', function() {
|
19
16
|
$.re_block();
|
20
|
-
$.post($('#re_plan_new_form').attr('action'), $('#re_plan_new_form').serialize(),
|
21
|
-
$.fancybox.resize();
|
22
|
-
$.re_unblock();
|
23
|
-
}, 'script');
|
17
|
+
$.post($('#re_plan_new_form').attr('action'), $('#re_plan_new_form').serialize(), null, 'script');
|
24
18
|
|
25
19
|
return false;
|
26
20
|
});
|
@@ -32,10 +32,7 @@ $(document).ready(function() {
|
|
32
32
|
}
|
33
33
|
|
34
34
|
$.re_block();
|
35
|
-
$.get('/re_plans/' + plan_id + '/workflows/new', null,
|
36
|
-
$.re_unblock();
|
37
|
-
$.fancybox({ href: '#re_content'});
|
38
|
-
}, 'script');
|
35
|
+
$.get('/re_plans/' + plan_id + '/workflows/new', null, null, 'script');
|
39
36
|
|
40
37
|
return false;
|
41
38
|
});
|
@@ -47,10 +44,7 @@ $(document).ready(function() {
|
|
47
44
|
|
48
45
|
$('#re_workflow_new_insert').live('click', function() {
|
49
46
|
$.re_block();
|
50
|
-
$.post($('#re_workflow_new_form').attr('action'), $('#re_workflow_new_form').serialize(),
|
51
|
-
$.fancybox.resize();
|
52
|
-
$.re_unblock();
|
53
|
-
}, 'script');
|
47
|
+
$.post($('#re_workflow_new_form').attr('action'), $('#re_workflow_new_form').serialize(), null, 'script');
|
54
48
|
|
55
49
|
return false;
|
56
50
|
});
|
@@ -95,10 +89,7 @@ $(document).ready(function() {
|
|
95
89
|
var form_id = $(this).attr('href');
|
96
90
|
|
97
91
|
$.re_block();
|
98
|
-
$.post($(form_id).attr('action'), $(form_id).serialize(),
|
99
|
-
$.fancybox.close();
|
100
|
-
$.re_unblock();
|
101
|
-
}, 'script');
|
92
|
+
$.post($(form_id).attr('action'), $(form_id).serialize(), null, 'script');
|
102
93
|
return false;
|
103
94
|
});
|
104
95
|
|
@@ -11,6 +11,28 @@ re_workflow_action_confirm = function(id, title, action) {
|
|
11
11
|
|
12
12
|
$(document).ready(function() {
|
13
13
|
|
14
|
+
$('a#re_workflow_copy').live('click', function() {
|
15
|
+
var values = $(this).attr('href').replace('#', '').split('|');
|
16
|
+
|
17
|
+
$.re_block();
|
18
|
+
if (parseInt(values[0]) == 0)
|
19
|
+
$.get('/re_workflows/' + values[1] + '/copy', null, null, 'script');
|
20
|
+
else
|
21
|
+
$.get('/re_plans/' + values[0] + '/workflows/' + values[1] + '/copy', null, null, 'script');
|
22
|
+
return false;
|
23
|
+
});
|
24
|
+
|
25
|
+
$("#re_workflow_copy_cancel").live('click', function() {
|
26
|
+
$.fancybox.close();
|
27
|
+
return false;
|
28
|
+
});
|
29
|
+
|
30
|
+
$('#re_workflow_copy_duplicate').live('click', function() {
|
31
|
+
$.re_block();
|
32
|
+
$.post($('#re_workflow_copy_form').attr('action'), $('#re_workflow_copy_form').serialize(), null, 'script');
|
33
|
+
return false;
|
34
|
+
});
|
35
|
+
|
14
36
|
$('a#re_workflow_edit').live('click', function() {
|
15
37
|
var values = $(this).attr('href').replace('#', '').split('|');
|
16
38
|
|
@@ -135,10 +157,7 @@ $(document).ready(function() {
|
|
135
157
|
var form_id = $(this).attr('href');
|
136
158
|
|
137
159
|
$.re_block();
|
138
|
-
$.post($(form_id).attr('action'), $(form_id).serialize(),
|
139
|
-
$.fancybox.close();
|
140
|
-
$.re_unblock();
|
141
|
-
}, 'script');
|
160
|
+
$.post($(form_id).attr('action'), $(form_id).serialize(), null, 'script');
|
142
161
|
return false;
|
143
162
|
});
|
144
163
|
|
@@ -2,10 +2,7 @@ $(document).ready(function() {
|
|
2
2
|
|
3
3
|
$('a#re_workflow_new').live('click', function() {
|
4
4
|
$.re_block();
|
5
|
-
$.get('/re_workflows/new', null,
|
6
|
-
$.re_unblock();
|
7
|
-
$.fancybox({ href: '#re_content'});
|
8
|
-
}, 'script');
|
5
|
+
$.get('/re_workflows/new', null, null, 'script');
|
9
6
|
return false;
|
10
7
|
});
|
11
8
|
|
@@ -17,10 +14,7 @@ $(document).ready(function() {
|
|
17
14
|
|
18
15
|
$('#re_workflow_new_insert').live('click', function() {
|
19
16
|
$.re_block();
|
20
|
-
$.post($('#re_workflow_new_form').attr('action'), $('#re_workflow_new_form').serialize(),
|
21
|
-
$.fancybox.resize();
|
22
|
-
$.re_unblock();
|
23
|
-
}, 'script');
|
17
|
+
$.post($('#re_workflow_new_form').attr('action'), $('#re_workflow_new_form').serialize(), null, 'script');
|
24
18
|
|
25
19
|
return false;
|
26
20
|
});
|
@@ -0,0 +1,22 @@
|
|
1
|
+
$(document).ready(function() {
|
2
|
+
|
3
|
+
$('a.re-list-rule-help').live('click', function() {
|
4
|
+
var values = $(this).attr('href').replace('#', '').split('|');
|
5
|
+
|
6
|
+
$.re_block();
|
7
|
+
if (parseInt(values[0]) == 0)
|
8
|
+
$.get('/re_workflows/' + values[1] + '/rules/help?rule_class_name=' + values[2], null, null, 'script');
|
9
|
+
else
|
10
|
+
$.get('/re_plans/' + values[0] + '/workflows/' + values[1] + '/rules/help?rule_class_name=' + values[2], null, null, 'script');
|
11
|
+
|
12
|
+
return false;
|
13
|
+
});
|
14
|
+
|
15
|
+
$("#re_rule_help_cancel").live('click', function() {
|
16
|
+
$.fancybox.close();
|
17
|
+
return false;
|
18
|
+
});
|
19
|
+
|
20
|
+
});
|
21
|
+
|
22
|
+
|
Binary file
|
Binary file
|
@@ -35,6 +35,10 @@
|
|
35
35
|
background: transparent url('./images/rules_engine/re_plan/change-25.png') no-repeat 0 4px;
|
36
36
|
padding: 0 0 0 30px;
|
37
37
|
}
|
38
|
+
.re-breadcrumbs .re-bc-plan-copy {
|
39
|
+
background: transparent url('./images/rules_engine/re_plan/copy-25.png') no-repeat 0 4px;
|
40
|
+
padding: 0 0 0 30px;
|
41
|
+
}
|
38
42
|
|
39
43
|
/* sub headers*/
|
40
44
|
h3.re-hdr-plan-alert {
|
@@ -58,18 +62,22 @@ h3.re-hdr-plan-delete {
|
|
58
62
|
h4.re-sts-plan-draft {
|
59
63
|
background: transparent url('./images/rules_engine/re_common/status-draft-18.png') no-repeat left 4px;
|
60
64
|
padding: 0 0 0 22px;
|
65
|
+
margin: 0;
|
61
66
|
}
|
62
67
|
h4.re-sts-plan-changed {
|
63
68
|
background: transparent url('./images/rules_engine/re_common/status-changed-18.png') no-repeat left 4px;
|
64
69
|
padding: 0 0 0 22px;
|
70
|
+
margin: 0;
|
65
71
|
}
|
66
72
|
h4.re-sts-plan-published {
|
67
73
|
background: transparent url('./images/rules_engine/re_common/status-published-18.png') no-repeat left 4px;
|
68
74
|
padding: 0 0 0 22px;
|
75
|
+
margin: 0;
|
69
76
|
}
|
70
77
|
h4.re-sts-plan-verify {
|
71
78
|
background: transparent url('./images/rules_engine/re_common/status-verify-18.png') no-repeat left 4px;
|
72
79
|
padding: 0 0 0 22px;
|
80
|
+
margin: 0;
|
73
81
|
}
|
74
82
|
em.re-sts-plan-draft {
|
75
83
|
color: #696969;
|
@@ -112,6 +120,15 @@ a.re-menu-plan-change {
|
|
112
120
|
a.re-menu-plan-change:hover {
|
113
121
|
text-decoration: underline;
|
114
122
|
}
|
123
|
+
a.re-menu-plan-copy {
|
124
|
+
background: transparent url('./images/rules_engine/re_plan/copy-25.png') no-repeat left -1px;
|
125
|
+
padding: 0 0 0 28px;
|
126
|
+
color: #218868;
|
127
|
+
text-decoration: none;
|
128
|
+
}
|
129
|
+
a.re-menu-plan-copy:hover {
|
130
|
+
text-decoration: underline;
|
131
|
+
}
|
115
132
|
a.re-menu-plan-edit {
|
116
133
|
background: transparent url('./images/rules_engine/re_plan/edit-25.png') no-repeat left -1px;
|
117
134
|
padding: 0 0 0 30px;
|
@@ -208,6 +225,11 @@ div.re-xtra-plan-preview {
|
|
208
225
|
background: transparent url('./images/rules_engine/re_workflow/edit-25.png') no-repeat 0 4px;
|
209
226
|
padding: 0 0 0 30px;
|
210
227
|
}
|
228
|
+
.re-breadcrumbs .re-bc-workflow-copy {
|
229
|
+
background: transparent url('./images/rules_engine/re_workflow/copy-25.png') no-repeat 0 4px;
|
230
|
+
padding: 0 0 0 30px;
|
231
|
+
}
|
232
|
+
|
211
233
|
|
212
234
|
/* sub headers*/
|
213
235
|
h3.re-hdr-workflow-alert {
|
@@ -239,10 +261,12 @@ h3.re-hdr-workflow-delete {
|
|
239
261
|
h4.re-sts-workflow-valid {
|
240
262
|
background: transparent url('./images/rules_engine/re_common/status-valid-18.png') no-repeat left 4px;
|
241
263
|
padding: 0 0 0 22px;
|
264
|
+
margin: 0;
|
242
265
|
}
|
243
266
|
h4.re-sts-workflow-verify {
|
244
267
|
background: transparent url('./images/rules_engine/re_common/status-verify-18.png') no-repeat left 4px;
|
245
268
|
padding: 0 0 0 22px;
|
269
|
+
margin: 0;
|
246
270
|
}
|
247
271
|
em.re-sts-workflow-valid {
|
248
272
|
color: #218868;
|
@@ -283,6 +307,7 @@ a.re-menu-workflow-add-link {
|
|
283
307
|
color: #222;
|
284
308
|
line-height: 19px;
|
285
309
|
text-decoration: none;
|
310
|
+
width:200px;
|
286
311
|
}
|
287
312
|
a.re-menu-workflow-add-link:hover {
|
288
313
|
text-decoration: underline;
|
@@ -295,6 +320,7 @@ a.re-menu-workflow-add-link-off {
|
|
295
320
|
color: #222;
|
296
321
|
line-height: 19px;
|
297
322
|
text-decoration: none;
|
323
|
+
width:200px;
|
298
324
|
}
|
299
325
|
a.re-menu-workflow-add-link-off:hover {
|
300
326
|
text-decoration: none;
|
@@ -314,6 +340,15 @@ a.re-menu-workflow-show {
|
|
314
340
|
a.re-menu-workflow-show:hover {
|
315
341
|
text-decoration: underline;
|
316
342
|
}
|
343
|
+
a.re-menu-workflow-copy {
|
344
|
+
background: transparent url('./images/rules_engine/re_workflow/copy-25.png') no-repeat left -1px;
|
345
|
+
padding: 0 0 0 28px;
|
346
|
+
color: #218868;
|
347
|
+
text-decoration: none;
|
348
|
+
}
|
349
|
+
a.re-menu-workflow-copy:hover {
|
350
|
+
text-decoration: underline;
|
351
|
+
}
|
317
352
|
a.re-menu-workflow-edit {
|
318
353
|
background: transparent url('./images/rules_engine/re_workflow/edit-25.png') no-repeat left -1px;
|
319
354
|
padding: 0 0 0 30px;
|
@@ -505,19 +540,23 @@ h3.re-hdr-rule-alert {
|
|
505
540
|
h4.re-sts-rule-valid {
|
506
541
|
background: transparent url('./images/rules_engine/re_common/status-valid-18.png') no-repeat left 4px;
|
507
542
|
padding: 0 0 0 20px;
|
543
|
+
margin: 0;
|
508
544
|
}
|
509
545
|
h4.re-sts-rule-verify {
|
510
546
|
background: transparent url('./images/rules_engine/re_common/status-verify-18.png') no-repeat left 4px;
|
511
547
|
padding: 0 0 0 20px;
|
548
|
+
margin: 0;
|
512
549
|
}
|
513
550
|
|
514
551
|
h6.re-sts-rule-valid {
|
515
552
|
background: transparent url('./images/rules_engine/re_common/status-valid-14.png') no-repeat left 4px;
|
516
553
|
padding: 0 0 0 18px;
|
554
|
+
margin: 0;
|
517
555
|
}
|
518
556
|
h6.re-sts-rule-verify {
|
519
557
|
background: transparent url('./images/rules_engine/re_common/status-verify-14.png') no-repeat left 4px;
|
520
558
|
padding: 0 0 0 18px;
|
559
|
+
margin: 0;
|
521
560
|
}
|
522
561
|
|
523
562
|
/* menu */
|
@@ -601,6 +640,17 @@ a.re-list-rule-move-up-off {
|
|
601
640
|
a.re-list-rule-move-up-off span {
|
602
641
|
display: none;
|
603
642
|
}
|
643
|
+
a.re-list-rule-help {
|
644
|
+
float:right;
|
645
|
+
background: transparent url('./images/rules_engine/re_rule/help-25.png') no-repeat 0px 0px;
|
646
|
+
width: 25px;
|
647
|
+
height: 25px;
|
648
|
+
margin: 0px 3px 0 0;
|
649
|
+
}
|
650
|
+
a.re-list-rule-help span {
|
651
|
+
display: none;
|
652
|
+
}
|
653
|
+
|
604
654
|
|
605
655
|
/* extra */
|
606
656
|
div.re-xtra-rule-title-plural {
|
@@ -1076,6 +1126,7 @@ table.data-line tr.odd td {
|
|
1076
1126
|
.re-form-data .form-text{
|
1077
1127
|
display:inline-block;
|
1078
1128
|
font-size: 18px;
|
1129
|
+
line-height: 20px;
|
1079
1130
|
color: #222;
|
1080
1131
|
padding: 0 5px;
|
1081
1132
|
}
|
@@ -1320,7 +1371,7 @@ a.button-unchecked:hover { background-color: #696969; }
|
|
1320
1371
|
|
1321
1372
|
a.re-add-link {
|
1322
1373
|
display: block;
|
1323
|
-
background: url(./images/re_view_button/icon-add.png) left
|
1374
|
+
background: url(./images/re_view_button/icon-add.png) left 2px no-repeat;
|
1324
1375
|
text-decoration: none;
|
1325
1376
|
font-weight: normal;
|
1326
1377
|
padding: 0 0 2px 24px;
|
@@ -262,11 +262,15 @@ describe RulesEngine::Rule::<%=rule_class%> do
|
|
262
262
|
end
|
263
263
|
end
|
264
264
|
|
265
|
-
describe "
|
265
|
+
describe "before a rule is created" do
|
266
266
|
# xit "There is nothing to do here"
|
267
267
|
end
|
268
268
|
|
269
|
-
describe "
|
269
|
+
describe "before a rule is updated" do
|
270
|
+
# xit "There is nothing to do here"
|
271
|
+
end
|
272
|
+
|
273
|
+
describe "before a rule is destroyed" do
|
270
274
|
# xit "There is nothing to do here"
|
271
275
|
end
|
272
276
|
|
@@ -291,7 +295,7 @@ describe RulesEngine::Rule::<%=rule_class%> do
|
|
291
295
|
|
292
296
|
it "should add the match to the data" do
|
293
297
|
@<%=rule_name%>.process(@job, @matched_data)
|
294
|
-
@matched_data[:
|
298
|
+
@matched_data[:tweet_match].should == "word"
|
295
299
|
end
|
296
300
|
|
297
301
|
it "should audit the match" do
|
@@ -333,53 +337,54 @@ end
|
|
333
337
|
describe ReWorkflowRulesController, :type => :controller do
|
334
338
|
integrate_views
|
335
339
|
|
336
|
-
|
337
|
-
|
340
|
+
describe "RulesEngine::Rule::<%=rule_class%>" do
|
341
|
+
before(:each) do
|
342
|
+
controller.instance_eval { flash.stub!(:sweep) }
|
338
343
|
|
339
|
-
|
344
|
+
RulesEngine::Discovery.discover!
|
340
345
|
|
341
|
-
|
342
|
-
|
346
|
+
controller.stub!(:rules_engine_reader_access_required).and_return(true)
|
347
|
+
controller.stub!(:rules_engine_editor_access_required).and_return(true)
|
343
348
|
|
344
|
-
|
345
|
-
|
346
|
-
|
349
|
+
@re_workflow = ReWorkflow.make
|
350
|
+
ReWorkflow.stub!(:find).and_return(@re_workflow)
|
351
|
+
end
|
347
352
|
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
353
|
+
describe "<%=rule_name%> rule help" do
|
354
|
+
it "should assign the <%=rule_name%> rule class" do
|
355
|
+
get :help, :rule_class_name => "RulesEngine::Rule::<%=rule_class%>"
|
356
|
+
assigns[:rule_class].should == RulesEngine::Rule::<%=rule_class%>
|
357
|
+
end
|
352
358
|
end
|
353
|
-
end
|
354
359
|
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
360
|
+
describe "new" do
|
361
|
+
it "show the new form" do
|
362
|
+
get :new, :rule_class_name => "RulesEngine::Rule::<%=rule_class%>"
|
363
|
+
response.should have_tag("form#re_rule_new_form") do
|
364
|
+
with_tag("input#<%=rule_name%>_title")
|
365
|
+
with_tag("input#<%=rule_name%>_words_0_word")
|
366
|
+
with_tag("select#<%=rule_name%>_workflow_action")
|
367
|
+
with_tag("input#<%=rule_name%>_workflow")
|
368
|
+
end
|
369
|
+
end
|
364
370
|
end
|
365
|
-
end
|
366
371
|
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
372
|
+
describe "edit" do
|
373
|
+
it "show the edit form" do
|
374
|
+
re_rule = ReRule.make(:re_workflow_id => @re_workflow.id,
|
375
|
+
:rule_class_name => "RulesEngine::Rule::<%=rule_class%>",
|
376
|
+
:data => valid_<%=rule_name%>_rule_data)
|
377
|
+
ReRule.stub!(:find).and_return(re_rule)
|
373
378
|
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
379
|
+
get :edit, :re_workflow_id => @re_workflow.id, :re_rule_id => 1001, :rule_class_name => "RulesEngine::Rule::<%=rule_class%>"
|
380
|
+
response.should have_tag("form#re_rule_edit_form") do
|
381
|
+
with_tag("input#<%=rule_name%>_title", :value => 'Rule Title')
|
382
|
+
with_tag("input#<%=rule_name%>_words_0_word", :value => 'word one')
|
383
|
+
with_tag("input#<%=rule_name%>_words_1_word", :value => 'word two')
|
384
|
+
with_tag("select#<%=rule_name%>_workflow_action", :value => 'start_workflow')
|
385
|
+
with_tag("input#<%=rule_name%>_workflow", :value => 'Other Workflow')
|
386
|
+
end
|
387
|
+
end
|
382
388
|
end
|
383
389
|
end
|
384
|
-
|
385
390
|
end
|