rules_engine 0.1.10 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/rails_generators/manifests/rules_engine.rb +25 -18
- data/rails_generators/manifests/rules_engine.yml +10 -3
- data/rails_generators/templates/app/controllers/re_history_controller.rb +15 -0
- data/rails_generators/templates/app/controllers/re_plan_workflows_controller.rb +12 -23
- data/rails_generators/templates/app/controllers/re_plans_controller.rb +11 -11
- data/rails_generators/templates/app/controllers/re_workflow_rules_controller.rb +2 -1
- data/rails_generators/templates/app/controllers/re_workflows_controller.rb +7 -7
- data/rails_generators/templates/app/helpers/rules_engine_helper.rb +1 -1
- data/rails_generators/templates/app/models/re_plan.rb +1 -1
- data/rails_generators/templates/app/models/re_rule.rb +1 -2
- data/rails_generators/templates/app/models/re_workflow.rb +1 -9
- data/rails_generators/templates/app/views/re_history/_index_prepare.html.erb +12 -0
- data/rails_generators/templates/app/views/re_history/_index_update.html.erb +20 -0
- data/rails_generators/templates/app/views/re_history/_show.html.erb +30 -0
- data/rails_generators/templates/app/views/re_history/index.html.erb +11 -0
- data/rails_generators/templates/app/views/re_history/index.js.erb +4 -0
- data/rails_generators/templates/app/views/re_history/show.html.erb +8 -0
- data/rails_generators/templates/app/views/re_history/show.js.erb +4 -0
- data/rails_generators/templates/app/views/re_plans/_copy.html.erb +1 -1
- data/rails_generators/templates/app/views/re_plans/{re_process.html.erb → history.html.erb} +3 -3
- data/rails_generators/templates/app/views/re_plans/history.js.erb +4 -0
- data/rails_generators/templates/app/views/re_plans/index.html.erb +2 -2
- data/rails_generators/templates/app/views/re_plans/preview.html.erb +0 -1
- data/rails_generators/templates/app/views/re_plans/show.html.erb +2 -2
- data/rails_generators/templates/app/views/re_workflows/_copy.html.erb +1 -1
- data/rails_generators/templates/app/views/re_workflows/index.html.erb +2 -2
- data/rails_generators/templates/doc/README.rules_engine +1 -1
- data/rails_generators/templates/public/javascripts/rules_engine/re_history_index.js +43 -0
- data/rails_generators/templates/public/javascripts/rules_engine/{re_process_show.js → re_history_show.js} +3 -3
- data/rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/{re_process → re_history}/error-14.png +0 -0
- data/rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/{re_process → re_history}/info-14.png +0 -0
- data/rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/{re_process → re_history}/list-25.png +0 -0
- data/rails_generators/templates/public/stylesheets/rules_engine/images/rules_engine/{re_process → re_history}/success-14.png +0 -0
- data/rails_generators/templates/public/stylesheets/rules_engine/screen.css +19 -69
- data/rails_generators/templates/spec/controllers/re_application_controller_spec.rb +68 -0
- data/rails_generators/templates/spec/controllers/re_history_controller_spec.rb +41 -0
- data/rails_generators/templates/spec/controllers/re_plan_workflow_rules_controller_spec.rb +355 -0
- data/rails_generators/templates/spec/controllers/re_plan_workflows_controller_spec.rb +364 -0
- data/rails_generators/templates/spec/controllers/re_plans_controller_spec.rb +165 -223
- data/rails_generators/templates/spec/controllers/re_publications_controller_spec.rb +29 -0
- data/rails_generators/templates/spec/controllers/re_workflow_rules_controller_spec.rb +353 -0
- data/rails_generators/templates/spec/controllers/re_workflows_controller_spec.rb +326 -0
- data/rails_generators/templates/spec/helpers/rules_engine_helper_spec.rb +8 -8
- metadata +28 -21
- data/rails_generators/templates/app/controllers/re_processes_controller.rb +0 -15
- data/rails_generators/templates/app/views/re_plans/re_process.js.erb +0 -4
- data/rails_generators/templates/app/views/re_processes/_index_prepare.html.erb +0 -12
- data/rails_generators/templates/app/views/re_processes/_index_update.html.erb +0 -20
- data/rails_generators/templates/app/views/re_processes/_show.html.erb +0 -30
- data/rails_generators/templates/app/views/re_processes/index.html.erb +0 -11
- data/rails_generators/templates/app/views/re_processes/index.js.erb +0 -4
- data/rails_generators/templates/app/views/re_processes/show.html.erb +0 -8
- data/rails_generators/templates/app/views/re_processes/show.js.erb +0 -4
- data/rails_generators/templates/public/javascripts/rules_engine/re_process_index.js +0 -43
@@ -0,0 +1,11 @@
|
|
1
|
+
<% set_re_javascript_include ['rules_engine/re_history_index', 'rules_engine/re_history_show'] %>
|
2
|
+
<% set_re_breadcrumbs link_to("All Plans", re_plans_path, :class => "re-bc-plan-list"),
|
3
|
+
'<span class="re-bc-history-list">Process History</span>' %>
|
4
|
+
|
5
|
+
<div class="prepend-1 span-22 append-1">
|
6
|
+
<div class="re-infobox">
|
7
|
+
<%= render '/re_history/index_prepare', :re_plan_id => 0 %>
|
8
|
+
<div class="clear top-5"></div>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
<div class="clear"></div>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% set_re_breadcrumbs link_to("All Plans", re_plans_path, :class => "re-bc-plan-list"),
|
2
|
+
link_to("Process History", re_history_index_path, :class => "re-bc-history-list"),
|
3
|
+
'<span class="re-bc-history-list">Process Audit</span>' %>
|
4
|
+
|
5
|
+
<div class="span-22 prepend-1 append-1">
|
6
|
+
<%= render '/re_history/show' %>
|
7
|
+
</div>
|
8
|
+
<div class="clear"></div>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<h3 class="re-hdr-plan-copy"> Copy Plan : <%=h @re_plan.title %></h3>
|
3
3
|
<div class="clear top-10"></div>
|
4
4
|
|
5
|
-
<% re_form_for(@
|
5
|
+
<% re_form_for(@re_plan_copy, :url => duplicate_re_plan_path(@re_plan), :method => :post, :span => "3x13", :html => {:id => "re_plan_copy_form"}) do |f| %>
|
6
6
|
<%= f.error_messages :message => "Unable To Duplicated Plan" %>
|
7
7
|
<% re_whitebox do %>
|
8
8
|
<%= f.text_field(:code, :required => true, :hint => "must be unique") %>
|
@@ -1,11 +1,11 @@
|
|
1
|
-
<% set_re_javascript_include ['rules_engine/
|
1
|
+
<% set_re_javascript_include ['rules_engine/re_history_index'] %>
|
2
2
|
<% set_re_breadcrumbs link_to("All Plans", re_plans_path, :class => "re-bc-plan-list"),
|
3
3
|
link_to("Show Plan", re_plan_path(@re_plan), :class => "re-bc-plan-show"),
|
4
|
-
'<span class="re-bc-
|
4
|
+
'<span class="re-bc-history-list">Process History</span>' %>
|
5
5
|
|
6
6
|
<div class="prepend-1 span-22 append-1">
|
7
7
|
<div class="re-infobox">
|
8
|
-
<%= render '/
|
8
|
+
<%= render '/re_history/index_prepare', :re_plan_id => @re_plan.id %>
|
9
9
|
<div class="clear top-5"></div>
|
10
10
|
</div>
|
11
11
|
</div>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% set_re_javascript_include ['rules_engine/re_plan_preview', 'rules_engine/re_plan_new', 'rules_engine/
|
1
|
+
<% set_re_javascript_include ['rules_engine/re_plan_preview', 'rules_engine/re_plan_new', 'rules_engine/re_history_index', 'rules_engine/re_history_show'] %>
|
2
2
|
<% set_re_breadcrumbs_right link_to("All Plans", re_plans_path, :class => "re-bc-plan-list"),
|
3
3
|
link_to("<em>All Workflows</em>", re_workflows_path, :class => "re-bc-workflow-list blue")%>
|
4
4
|
|
@@ -28,6 +28,6 @@
|
|
28
28
|
<div class="clear top-5"></div>
|
29
29
|
<% end %>
|
30
30
|
|
31
|
-
<%= render '/
|
31
|
+
<%= render '/re_history/index_prepare', :re_plan_id => 0 %>
|
32
32
|
<div class="clear"></div>
|
33
33
|
</div>
|
@@ -1,4 +1,3 @@
|
|
1
|
-
<%# set_re_javascript_include ['rules_engine/re_process_index', 'rules_engine/re_plan_show_processs'] %>
|
2
1
|
<% set_re_breadcrumbs link_to("All Plans", re_plans_path, :class => "re-bc-plan-list"), '<span class="re-bc-plan-show">Preview Plan</span>' %>
|
3
2
|
|
4
3
|
<div class="prepend-1 span-22 append-1">
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% set_re_javascript_include ['rules_engine/re_workflow_preview', 'rules_engine/re_publication_show', 'rules_engine/
|
1
|
+
<% set_re_javascript_include ['rules_engine/re_workflow_preview', 'rules_engine/re_publication_show', 'rules_engine/re_history_index', 'rules_engine/re_history_show'] %>
|
2
2
|
<% set_re_breadcrumbs link_to("All Plans", re_plans_path, :class => "re-bc-plan-list"), '<span class="re-bc-plan-show">View Plan</span>' %>
|
3
3
|
|
4
4
|
<div class="span-17 border">
|
@@ -42,7 +42,7 @@
|
|
42
42
|
<div class="clear top-5"></div>
|
43
43
|
<% end %>
|
44
44
|
|
45
|
-
<%= render '/
|
45
|
+
<%= render '/re_history/index_prepare', :re_plan_id => @re_plan.id %>
|
46
46
|
<div class="clear top-5"></div>
|
47
47
|
|
48
48
|
<div class="clear top-20"></div>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<h3 class="re-hdr-workflow-new">Copy Workflow : <%=h @re_workflow.title %></h3>
|
6
6
|
<div class="clear top-10"></div>
|
7
7
|
|
8
|
-
<% re_form_for(@
|
8
|
+
<% re_form_for(@re_workflow_copy, :url => duplicate_path, :method => :post, :span => "3x13", :html => {:id => "re_workflow_copy_form"}) do |f| %>
|
9
9
|
<%= f.error_messages :message => "Unable To Duplicate Workflow" %>
|
10
10
|
<% re_whitebox do %>
|
11
11
|
<%= f.text_field(:code, :required => true, :hint => "must be unique") %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% set_re_javascript_include ['rules_engine/re_workflow_preview', 'rules_engine/re_workflow_new', 'rules_engine/
|
1
|
+
<% set_re_javascript_include ['rules_engine/re_workflow_preview', 'rules_engine/re_workflow_new', 'rules_engine/re_history_index', 'rules_engine/re_history_show'] %>
|
2
2
|
<% set_re_breadcrumbs_right link_to("All Workflows", re_workflows_path, :class => "re-bc-workflow-list"),
|
3
3
|
link_to("<em>All Plans</em>", re_plans_path, :class => "re-bc-plan-list blue")%>
|
4
4
|
|
@@ -29,6 +29,6 @@
|
|
29
29
|
<div class="clear top-5"></div>
|
30
30
|
<% end %>
|
31
31
|
|
32
|
-
<%= render '/
|
32
|
+
<%= render '/re_history/index_prepare', :re_plan_id => 0 %>
|
33
33
|
<div class="clear top-5"></div>
|
34
34
|
</div>
|
@@ -96,7 +96,7 @@ ActionController::Routing::Routes.draw do |map|
|
|
96
96
|
:member => {:move_up => :put, :move_down => :put}
|
97
97
|
end
|
98
98
|
|
99
|
-
map.resources :
|
99
|
+
map.resources :re_history, :only => [:index, :show]
|
100
100
|
map.resources :re_publications, :only => [:show]
|
101
101
|
|
102
102
|
...
|
@@ -0,0 +1,43 @@
|
|
1
|
+
re_history_list_get = function(page) {
|
2
|
+
var plan_id = $('.re-menu-history-list:first').attr('id').replace('re_menu_process_list_', '')
|
3
|
+
|
4
|
+
if (plan_id.length == 0 || plan_id == "0")
|
5
|
+
$.get('/re_history?page=' + page, null, null, 'script');
|
6
|
+
else
|
7
|
+
$.get('/re_plans/' + plan_id + '/history?page=' + page, null, null, 'script');
|
8
|
+
}
|
9
|
+
|
10
|
+
$(document).ready(function() {
|
11
|
+
|
12
|
+
re_history_list_get(1);
|
13
|
+
|
14
|
+
$('.re-xtra-history-next-enabled').live('click', function() {
|
15
|
+
var page = $(this).attr('href').replace('#', '')
|
16
|
+
|
17
|
+
$('#re_history_list').hide();
|
18
|
+
$('#re_history_list_pending').show();
|
19
|
+
|
20
|
+
re_history_list_get(page);
|
21
|
+
return false;
|
22
|
+
});
|
23
|
+
|
24
|
+
$('.re-xtra-history-next-disabled').live('click', function() {
|
25
|
+
return false;
|
26
|
+
});
|
27
|
+
|
28
|
+
$('.re-xtra-history-prev-enabled').live('click', function() {
|
29
|
+
var page = $(this).attr('href').replace('#', '')
|
30
|
+
|
31
|
+
$('#re_history_list').hide();
|
32
|
+
$('#re_history_list_pending').show();
|
33
|
+
|
34
|
+
re_history_list_get(page);
|
35
|
+
return false;
|
36
|
+
});
|
37
|
+
|
38
|
+
$('.re-xtra-history-prev-disabled').live('click', function() {
|
39
|
+
return false;
|
40
|
+
});
|
41
|
+
});
|
42
|
+
|
43
|
+
|
@@ -1,14 +1,14 @@
|
|
1
1
|
$(document).ready(function() {
|
2
2
|
|
3
|
-
$('a.re-xtra-
|
3
|
+
$('a.re-xtra-history-show').live('click', function() {
|
4
4
|
var id = $(this).attr('href').replace('#', '')
|
5
5
|
|
6
6
|
$.re_block();
|
7
|
-
$.get('/
|
7
|
+
$.get('/re_history/' + id, null, null, 'script');
|
8
8
|
return false;
|
9
9
|
});
|
10
10
|
|
11
|
-
$("#
|
11
|
+
$("#re_history_show_close").live('click', function() {
|
12
12
|
$.fancybox.close();
|
13
13
|
return false;
|
14
14
|
});
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -757,53 +757,53 @@ div.re-xtra-publication-show-pending {
|
|
757
757
|
}
|
758
758
|
|
759
759
|
/* ************************************* */
|
760
|
-
/*
|
760
|
+
/* HISTORY */
|
761
761
|
/* ************************************* */
|
762
|
-
.re-breadcrumbs .re-bc-
|
763
|
-
background: transparent url('./images/rules_engine/
|
762
|
+
.re-breadcrumbs .re-bc-history-list {
|
763
|
+
background: transparent url('./images/rules_engine/re_history/list-25.png') no-repeat 0 4px;
|
764
764
|
padding: 0 0 0 30px;
|
765
765
|
}
|
766
766
|
|
767
|
-
h3.re-hdr-
|
768
|
-
background: transparent url('./images/rules_engine/
|
767
|
+
h3.re-hdr-history-show {
|
768
|
+
background: transparent url('./images/rules_engine/re_history/list-25.png') no-repeat left 2px;
|
769
769
|
padding: 0 0 0 30px;
|
770
770
|
}
|
771
771
|
|
772
|
-
div.re-menu-
|
773
|
-
background: transparent url('./images/rules_engine/
|
772
|
+
div.re-menu-history-list {
|
773
|
+
background: transparent url('./images/rules_engine/re_history/list-25.png') no-repeat left -1px;
|
774
774
|
padding: 0 0 0 30px;
|
775
775
|
color: #222;
|
776
776
|
text-decoration: none;
|
777
777
|
}
|
778
778
|
|
779
|
-
div.re-xtra-
|
779
|
+
div.re-xtra-history-list-pending {
|
780
780
|
background: transparent url('./images/rules_engine/re_common/loading.gif') no-repeat 20px 4px;
|
781
781
|
padding: 16px 0 0 50px;
|
782
782
|
color: #696969;
|
783
783
|
}
|
784
784
|
|
785
|
-
a.re-xtra-
|
785
|
+
a.re-xtra-history-next-enabled {
|
786
786
|
float: right;
|
787
787
|
background: transparent url('./images/rules_engine/re_common/list-next-enabled-14.png') no-repeat 0px 0px;
|
788
788
|
height: 16px;
|
789
789
|
width: 16px;
|
790
790
|
padding: 0 5px 0 2px;
|
791
791
|
}
|
792
|
-
a.re-xtra-
|
792
|
+
a.re-xtra-history-next-disabled {
|
793
793
|
float: right;
|
794
794
|
background: transparent url('./images/rules_engine/re_common/list-next-disabled-14.png') no-repeat 0px 0px;
|
795
795
|
height: 16px;
|
796
796
|
width: 16px;
|
797
797
|
padding: 0 5px 0 2px;
|
798
798
|
}
|
799
|
-
a.re-xtra-
|
799
|
+
a.re-xtra-history-prev-enabled {
|
800
800
|
float: right;
|
801
801
|
background: transparent url('./images/rules_engine/re_common/list-prev-enabled-14.png') no-repeat 0px 0px;
|
802
802
|
height: 16px;
|
803
803
|
width: 16px;
|
804
804
|
padding: 0 2px 0 5px;
|
805
805
|
}
|
806
|
-
a.re-xtra-
|
806
|
+
a.re-xtra-history-prev-disabled {
|
807
807
|
float: right;
|
808
808
|
background: transparent url('./images/rules_engine/re_common/list-prev-disabled-14.png') no-repeat 0px 0px;
|
809
809
|
height: 16px;
|
@@ -811,93 +811,43 @@ a.re-xtra-process-prev-disabled {
|
|
811
811
|
padding: 0 2px 0 5px;
|
812
812
|
}
|
813
813
|
|
814
|
-
.re-xtra-
|
814
|
+
.re-xtra-history-success {
|
815
815
|
background: transparent url('./images/rules_engine/re_common/status-success-14.png') no-repeat 0px 2px;
|
816
816
|
height: 16px;
|
817
817
|
padding-left: 20px;
|
818
818
|
}
|
819
|
-
.re-xtra-
|
819
|
+
.re-xtra-history-error {
|
820
820
|
background: transparent url('./images/rules_engine/re_common/status-error-14.png') no-repeat 0px 2px;
|
821
821
|
height: 16px;
|
822
822
|
padding-left: 20px;
|
823
823
|
}
|
824
|
-
.re-xtra-
|
824
|
+
.re-xtra-history-info {
|
825
825
|
background: transparent url('./images/rules_engine/re_common/status-info-14.png') no-repeat 0px 2px;
|
826
826
|
height: 16px;
|
827
827
|
padding-left: 20px;
|
828
828
|
}
|
829
|
-
.re-xtra-
|
829
|
+
.re-xtra-history-running {
|
830
830
|
background: transparent url('./images/rules_engine/re_common/status-info-14.png') no-repeat 0px 2px;
|
831
831
|
height: 16px;
|
832
832
|
padding-left: 20px;
|
833
833
|
}
|
834
834
|
|
835
|
-
.re-xtra-
|
835
|
+
.re-xtra-history-audit-success {
|
836
836
|
background: transparent url('./images/rules_engine/re_common/status-success-14.png') no-repeat 0px 2px;
|
837
837
|
height: 16px;
|
838
838
|
padding-left: 20px;
|
839
839
|
}
|
840
|
-
.re-xtra-
|
840
|
+
.re-xtra-history-audit-error {
|
841
841
|
background: transparent url('./images/rules_engine/re_common/status-error-14.png') no-repeat 0px 2px;
|
842
842
|
height: 16px;
|
843
843
|
padding-left: 20px;
|
844
844
|
}
|
845
|
-
.re-xtra-
|
845
|
+
.re-xtra-history-audit-info {
|
846
846
|
background: transparent url('./images/rules_engine/re_common/status-info-14.png') no-repeat 0px 2px;
|
847
847
|
height: 16px;
|
848
848
|
padding-left: 20px;
|
849
849
|
}
|
850
850
|
|
851
|
-
/*div.re-menu-process-list {
|
852
|
-
background: transparent url('./images/rules_engine/re_process/list-25.png') no-repeat left -1px;
|
853
|
-
padding: 0 0 0 30px;
|
854
|
-
color: #244A9F;
|
855
|
-
text-decoration: none;
|
856
|
-
}
|
857
|
-
|
858
|
-
.re-process-success {
|
859
|
-
background: transparent url('./images/rules_engine/re_process/success-14.png') no-repeat 0px 2px;
|
860
|
-
height: 16px;
|
861
|
-
padding-left: 20px;
|
862
|
-
}
|
863
|
-
.re-process-error {
|
864
|
-
background: transparent url('./images/rules_engine/re_process/error-14.png') no-repeat 0px 2px;
|
865
|
-
height: 16px;
|
866
|
-
padding-left: 20px;
|
867
|
-
}
|
868
|
-
.re-process-info {
|
869
|
-
background: transparent url('./images/rules_engine/re_process/info-14.png') no-repeat 0px 2px;
|
870
|
-
height: 16px;
|
871
|
-
padding-left: 20px;
|
872
|
-
}
|
873
|
-
|
874
|
-
.process-running {
|
875
|
-
background: transparent url('./images/rules_engine/re_process/info-14.png') no-repeat 0px 2px;
|
876
|
-
height: 16px;
|
877
|
-
padding-left: 20px;
|
878
|
-
}
|
879
|
-
|
880
|
-
#re_process_list_pending {
|
881
|
-
background: transparent url('./images/rules_engine/re_process/loadingAnimation.gif') no-repeat 20px 10px;
|
882
|
-
padding : 20px 0px 5px 15px;
|
883
|
-
}
|
884
|
-
#re_process_list_pending h4 {
|
885
|
-
background: transparent url('./images/rules_engine/re_process/list-25.png') no-repeat 0px 4px;
|
886
|
-
padding: 5px 0 5px 30px;
|
887
|
-
color: #bbb;
|
888
|
-
}
|
889
|
-
|
890
|
-
a.re-process-detail {
|
891
|
-
color: #222;
|
892
|
-
text-decoration: none;
|
893
|
-
background-color: #222;
|
894
|
-
}
|
895
|
-
tr.re-process-row td, tr.re-process-row-odd td {
|
896
|
-
background-color: #FFEBCD;
|
897
|
-
}
|
898
|
-
*/
|
899
|
-
|
900
|
-
|
901
851
|
/* generated from src/re_view_table.css */
|
902
852
|
table{
|
903
853
|
margin:0;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
class MockRulesEngineController < ApplicationController
|
4
|
+
before_filter :rules_engine_editor_access_required, :only => [:editor]
|
5
|
+
before_filter :rules_engine_reader_access_required, :only => [:reader]
|
6
|
+
|
7
|
+
def editor
|
8
|
+
end
|
9
|
+
|
10
|
+
def reader
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "ReApplicationController", :type => :controller do
|
15
|
+
controller_name 'MockRulesEngine'
|
16
|
+
|
17
|
+
describe "editor" do
|
18
|
+
describe "editor access enabled" do
|
19
|
+
it "should be successfull with rules_engine_editor true" do
|
20
|
+
controller.stub(:cookies).and_return(:rules_engine_editor => 'true')
|
21
|
+
get :editor
|
22
|
+
response.should be_success
|
23
|
+
response.should render_template('editor')
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should be successfull with rules_engine_editor nil" do
|
27
|
+
controller.stub(:cookies).and_return({})
|
28
|
+
get :editor
|
29
|
+
response.should be_success
|
30
|
+
response.should render_template('editor')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "editor access disabled" do
|
35
|
+
it "should redirect to the root path" do
|
36
|
+
controller.stub(:cookies).and_return(:rules_engine_editor => 'false')
|
37
|
+
get :editor
|
38
|
+
response.should redirect_to(root_path)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "reader" do
|
44
|
+
describe "reder access enabled" do
|
45
|
+
it "should be successfull with rules_engine_reader true" do
|
46
|
+
controller.stub(:cookies).and_return(:rules_engine_reader => 'true')
|
47
|
+
get :reader
|
48
|
+
response.should be_success
|
49
|
+
response.should render_template('reader')
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should be successfull with rules_engine_reader nil" do
|
53
|
+
controller.stub(:cookies).and_return({})
|
54
|
+
get :reader
|
55
|
+
response.should be_success
|
56
|
+
response.should render_template('reader')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "reader access disabled" do
|
61
|
+
it "should redirect to the root path" do
|
62
|
+
controller.stub(:cookies).and_return(:rules_engine_reader => 'false')
|
63
|
+
get :reader
|
64
|
+
response.should redirect_to(root_path)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|