rules_engine 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/README.textile +8 -5
  2. data/VERSION +1 -1
  3. data/rails_generators/manifests/rules_engine.rb +23 -23
  4. data/rails_generators/manifests/rules_engine.yml +4 -4
  5. data/rails_generators/templates/app/controllers/{re_rules_controller.rb → re_pipeline_rules_controller.rb} +1 -1
  6. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/_change.html.erb +0 -0
  7. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/_edit.html.erb +0 -0
  8. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/_empty.html.erb +0 -0
  9. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/_empty.js.erb +0 -0
  10. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/_error.html.erb +0 -0
  11. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/_help.html.erb +0 -0
  12. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/_index.html.erb +0 -0
  13. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/_menu.html.erb +0 -0
  14. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/_new.html.erb +0 -0
  15. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/_show.html.erb +0 -0
  16. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/destroy.js.erb +0 -0
  17. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/edit.html.erb +0 -0
  18. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/edit.js.erb +0 -0
  19. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/error.html.erb +0 -0
  20. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/error.js.erb +0 -0
  21. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/help.html.erb +0 -0
  22. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/help.js.erb +0 -0
  23. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/new.html.erb +0 -0
  24. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/new.js.erb +0 -0
  25. data/rails_generators/templates/app/views/{re_rules → re_pipeline_rules}/update.js.erb +0 -0
  26. data/rails_generators/templates/doc/README.rules_engine +8 -5
  27. data/rails_generators/templates/spec/controllers/re_jobs_controller_spec.rb +1 -1
  28. data/rails_generators/templates/spec/controllers/re_pipeline_jobs_controller_spec.rb +1 -1
  29. data/rails_generators/templates/spec/controllers/{re_rules_controller_spec.rb → re_pipeline_rules_controller_spec.rb} +36 -36
  30. data/rails_generators/templates/spec/controllers/re_pipelines_controller_spec.rb +10 -10
  31. data/rails_generators/templates/spec/support/rules_engine_macros.rb +6 -13
  32. metadata +26 -26
data/README.textile CHANGED
@@ -98,12 +98,15 @@ ActionController::Routing::Routes.draw do |map|
98
98
  :activate => :put,
99
99
  :deactivate => :put,
100
100
  :revert => :put} do |re_pipeline|
101
- re_pipeline.resources :re_rules,
102
- :collection => {:help => :get, :error => :get},
103
- :member => {:move_up => :put, :move_down => :put}
104
- re_pipeline.resources :re_jobs, :controller => :re_pipeline_jobs, :only => [:index]
101
+ re_pipeline.resources :re_rules,
102
+ :controller => :re_pipeline_rules,
103
+ :collection => {:help => :get, :error => :get},
104
+ :member => {:move_up => :put, :move_down => :put}
105
+ re_pipeline.resources :re_jobs,
106
+ :controller => :re_pipeline_jobs,
107
+ :only => [:index]
105
108
  end
106
-
109
+
107
110
  map.resources :re_jobs, :only => [:index, :show]
108
111
  ...
109
112
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -8,8 +8,8 @@ class RulesEngineManifest
8
8
  app/views/layouts
9
9
  app/views/re_jobs
10
10
  app/views/re_pipeline_jobs
11
+ app/views/re_pipeline_rules
11
12
  app/views/re_pipelines
12
- app/views/re_rules
13
13
  db/migrate
14
14
  doc
15
15
  features/re_pipeline
@@ -48,8 +48,8 @@ class RulesEngineManifest
48
48
  %W(
49
49
  app/controllers/re_jobs_controller.rb
50
50
  app/controllers/re_pipeline_jobs_controller.rb
51
+ app/controllers/re_pipeline_rules_controller.rb
51
52
  app/controllers/re_pipelines_controller.rb
52
- app/controllers/re_rules_controller.rb
53
53
  app/helpers/re_pipeline_helper.rb
54
54
  app/models/re_job.rb
55
55
  app/models/re_job_audit.rb
@@ -70,6 +70,26 @@ class RulesEngineManifest
70
70
  app/views/re_jobs/show.js.erb
71
71
  app/views/re_pipeline_jobs/index.html.erb
72
72
  app/views/re_pipeline_jobs/index.js.erb
73
+ app/views/re_pipeline_rules/_change.html.erb
74
+ app/views/re_pipeline_rules/_edit.html.erb
75
+ app/views/re_pipeline_rules/_empty.html.erb
76
+ app/views/re_pipeline_rules/_empty.js.erb
77
+ app/views/re_pipeline_rules/_error.html.erb
78
+ app/views/re_pipeline_rules/_help.html.erb
79
+ app/views/re_pipeline_rules/_index.html.erb
80
+ app/views/re_pipeline_rules/_menu.html.erb
81
+ app/views/re_pipeline_rules/_new.html.erb
82
+ app/views/re_pipeline_rules/_show.html.erb
83
+ app/views/re_pipeline_rules/destroy.js.erb
84
+ app/views/re_pipeline_rules/edit.html.erb
85
+ app/views/re_pipeline_rules/edit.js.erb
86
+ app/views/re_pipeline_rules/error.html.erb
87
+ app/views/re_pipeline_rules/error.js.erb
88
+ app/views/re_pipeline_rules/help.html.erb
89
+ app/views/re_pipeline_rules/help.js.erb
90
+ app/views/re_pipeline_rules/new.html.erb
91
+ app/views/re_pipeline_rules/new.js.erb
92
+ app/views/re_pipeline_rules/update.js.erb
73
93
  app/views/re_pipelines/_change.html.erb
74
94
  app/views/re_pipelines/_change_actions.html.erb
75
95
  app/views/re_pipelines/_confirm.html.erb
@@ -89,26 +109,6 @@ class RulesEngineManifest
89
109
  app/views/re_pipelines/show.html.erb
90
110
  app/views/re_pipelines/template.html.erb
91
111
  app/views/re_pipelines/update.js.erb
92
- app/views/re_rules/_change.html.erb
93
- app/views/re_rules/_edit.html.erb
94
- app/views/re_rules/_empty.html.erb
95
- app/views/re_rules/_empty.js.erb
96
- app/views/re_rules/_error.html.erb
97
- app/views/re_rules/_help.html.erb
98
- app/views/re_rules/_index.html.erb
99
- app/views/re_rules/_menu.html.erb
100
- app/views/re_rules/_new.html.erb
101
- app/views/re_rules/_show.html.erb
102
- app/views/re_rules/destroy.js.erb
103
- app/views/re_rules/edit.html.erb
104
- app/views/re_rules/edit.js.erb
105
- app/views/re_rules/error.html.erb
106
- app/views/re_rules/error.js.erb
107
- app/views/re_rules/help.html.erb
108
- app/views/re_rules/help.js.erb
109
- app/views/re_rules/new.html.erb
110
- app/views/re_rules/new.js.erb
111
- app/views/re_rules/update.js.erb
112
112
  db/migrate/20100308225008_create_re_pipelines.rb
113
113
  doc/README.rules_engine
114
114
  doc/README.rules_engine_features
@@ -371,8 +371,8 @@ class RulesEngineManifest
371
371
  public/stylesheets/rules_engine/re_rule_class/new-48.png
372
372
  spec/controllers/re_jobs_controller_spec.rb
373
373
  spec/controllers/re_pipeline_jobs_controller_spec.rb
374
+ spec/controllers/re_pipeline_rules_controller_spec.rb
374
375
  spec/controllers/re_pipelines_controller_spec.rb
375
- spec/controllers/re_rules_controller_spec.rb
376
376
  spec/helpers/re_pipeline_helper_spec.rb
377
377
  spec/models/re_job_audit_spec.rb
378
378
  spec/models/re_job_spec.rb
@@ -2,8 +2,8 @@ directories :
2
2
  list :
3
3
  - app/views/re_jobs
4
4
  - app/views/re_pipeline_jobs
5
+ - app/views/re_pipeline_rules
5
6
  - app/views/re_pipelines
6
- - app/views/re_rules
7
7
 
8
8
  - public/stylesheets/fancybox
9
9
  - public/stylesheets/blueprint
@@ -22,9 +22,9 @@ files :
22
22
  - doc/README.rules_engine_features
23
23
 
24
24
  - app/controllers/re_pipelines_controller.rb
25
- - app/controllers/re_rules_controller.rb
26
- - app/controllers/re_jobs_controller.rb
27
25
  - app/controllers/re_pipeline_jobs_controller.rb
26
+ - app/controllers/re_pipeline_rules_controller.rb
27
+ - app/controllers/re_jobs_controller.rb
28
28
 
29
29
  - app/helpers/re_pipeline_helper.rb
30
30
 
@@ -69,8 +69,8 @@ files :
69
69
 
70
70
  - spec/controllers/re_jobs_controller_spec.rb
71
71
  - spec/controllers/re_pipeline_jobs_controller_spec.rb
72
+ - spec/controllers/re_pipeline_rules_controller_spec.rb
72
73
  - spec/controllers/re_pipelines_controller_spec.rb
73
- - spec/controllers/re_rules_controller_spec.rb
74
74
 
75
75
  - spec/models/re_pipeline_base_spec.rb
76
76
  - spec/models/re_pipeline_spec.rb
@@ -1,4 +1,4 @@
1
- class ReRulesController < ApplicationController
1
+ class RePipelineRulesController < ApplicationController
2
2
  helper :re_pipeline
3
3
  layout 'rules_engine'
4
4
 
@@ -83,12 +83,15 @@ rake gems:install RAILS_ENV=test
83
83
  :activate => :put,
84
84
  :deactivate => :put,
85
85
  :revert => :put} do |re_pipeline|
86
- re_pipeline.resources :re_rules,
87
- :collection => {:help => :get, :error => :get},
88
- :member => {:move_up => :put, :move_down => :put}
89
- re_pipeline.resources :re_jobs, :controller => :re_pipeline_jobs, :only => [:index]
86
+ re_pipeline.resources :re_rules,
87
+ :controller => :re_pipeline_rules,
88
+ :collection => {:help => :get, :error => :get},
89
+ :member => {:move_up => :put, :move_down => :put}
90
+ re_pipeline.resources :re_jobs,
91
+ :controller => :re_pipeline_jobs,
92
+ :only => [:index]
90
93
  end
91
-
94
+
92
95
  map.resources :re_jobs, :only => [:index, :show]
93
96
  ...
94
97
  end
@@ -25,7 +25,7 @@ describe ReJobsController do
25
25
  end
26
26
 
27
27
  describe "show" do
28
- it_should_require_rules_engine_reader_access(:show)
28
+ it_should_require_rules_engine_reader_access(:show, :id => 101)
29
29
 
30
30
  it "should get the job" do
31
31
  re_job = mock_model(ReJob)
@@ -12,7 +12,7 @@ describe RePipelineJobsController do
12
12
  end
13
13
 
14
14
  describe "index" do
15
- it_should_require_rules_engine_reader_access(:index)
15
+ it_should_require_rules_engine_reader_access(:index, :re_pipeline_id => "1001")
16
16
 
17
17
  it "should load the pipeline" do
18
18
  RePipeline.should_receive(:find).with("1001").and_return(@re_pipeline)
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
- describe ReRulesController do
3
+ describe RePipelineRulesController do
4
4
  extend RulesEngineMacros
5
5
 
6
6
  before(:each) do
@@ -20,7 +20,7 @@ describe ReRulesController do
20
20
  end
21
21
 
22
22
  describe "help" do
23
- it_should_require_rules_engine_reader_access(:help)
23
+ it_should_require_rules_engine_reader_access(:help, :re_pipeline_id => 1001, :rule_class_name => "mock_rule_class")
24
24
 
25
25
  before(:each) do
26
26
  @rule_class = mock("RuleClass")
@@ -29,47 +29,47 @@ describe ReRulesController do
29
29
  end
30
30
 
31
31
  it "should assign the re_pipeline" do
32
- get :help, :re_pipeline => 1001, :rule_class_name => "mock_rule_class"
32
+ get :help, :re_pipeline_id => 1001, :rule_class_name => "mock_rule_class"
33
33
  assigns[:re_pipeline].should == @re_pipeline
34
34
  end
35
35
 
36
36
  it "should call load discover the rule" do
37
37
  RulesEngine::Discovery.should_receive(:rule_class).with("mock_rule_class").and_return(@rule_class)
38
- get :help, :re_pipeline => 1001, :rule_class_name => "mock_rule_class"
38
+ get :help, :re_pipeline_id => 1001, :rule_class_name => "mock_rule_class"
39
39
  end
40
-
40
+
41
41
  describe "rule class not found" do
42
42
  it "should render the 'error' template" do
43
43
  RulesEngine::Discovery.should_receive(:rule_class).with("mock_rule_class").and_return(nil)
44
- get :help, :re_pipeline => 1001, :rule_class_name => "mock_rule_class"
44
+ get :help, :re_pipeline_id => 1001, :rule_class_name => "mock_rule_class"
45
45
  response.should render_template(:error)
46
46
  end
47
47
  end
48
48
 
49
49
  describe "rule class found" do
50
50
  it "should assign the rule_class" do
51
- get :help, :re_pipeline => 1001, :rule_class_name => "mock_rule_class"
51
+ get :help, :re_pipeline_id => 1001, :rule_class_name => "mock_rule_class"
52
52
  assigns[:rule_class].should == @rule_class
53
53
  end
54
-
54
+
55
55
  it "should assign the rule" do
56
- get :help, :re_pipeline => 1001, :rule_class_name => "mock_rule_class"
56
+ get :help, :re_pipeline_id => 1001, :rule_class_name => "mock_rule_class"
57
57
  assigns[:rule].should == @rule
58
58
  end
59
59
  end
60
60
  end
61
-
61
+
62
62
  describe "error" do
63
- it_should_require_rules_engine_reader_access(:error)
63
+ it_should_require_rules_engine_reader_access(:error, :re_pipeline_id => 1001, :rule_class_name => "mock_rule_class")
64
64
 
65
65
  it "should assign the re_pipeline" do
66
- get :error, :re_pipeline => 1001, :rule_class_name => "mock_rule_class"
66
+ get :error, :re_pipeline_id => 1001, :rule_class_name => "mock_rule_class"
67
67
  assigns[:re_pipeline].should == @re_pipeline
68
68
  end
69
69
  end
70
70
 
71
71
  describe "new" do
72
- it_should_require_rules_engine_editor_access(:new)
72
+ it_should_require_rules_engine_editor_access(:new, :re_pipeline_id => 1001, :rule_class_name => "mock_rule_class")
73
73
 
74
74
  it "should assign the re_pipeline" do
75
75
  get :new, :re_pipeline_id => 1001, :rule_class_name => "mock_rule_class"
@@ -106,7 +106,7 @@ describe ReRulesController do
106
106
  @re_rule.stub!(:save).and_return(true)
107
107
  end
108
108
 
109
- it_should_require_rules_engine_editor_access(:create)
109
+ it_should_require_rules_engine_editor_access(:create, :re_pipeline_id => 1001, :rule_class_name => "mock_rule_class", :re_rule => { })
110
110
 
111
111
  it "should assign the re_pipeline" do
112
112
  post :create, :re_pipeline_id => 1001, :rule_class_name => "mock_rule_class", :re_rule => { :key => "value" }
@@ -132,11 +132,11 @@ describe ReRulesController do
132
132
  response.should render_template(:error)
133
133
  end
134
134
  end
135
-
135
+
136
136
  describe "rule class found" do
137
137
  it "should assign the rule attributes" do
138
- @re_rule.should_receive(:rule_attributes=).with(hash_including("re_pipeline" => "1001", "rule_class_name" => "mock_rule_class", "re_rule" => { "key" => "value" }))
139
- post :create, :re_pipeline => 1001, :rule_class_name => "mock_rule_class", :re_rule => { :key => "value" }
138
+ @re_rule.should_receive(:rule_attributes=).with(hash_including("re_pipeline_id" => "1001", "rule_class_name" => "mock_rule_class", "re_rule" => { "key" => "value" }))
139
+ post :create, :re_pipeline_id => 1001, :rule_class_name => "mock_rule_class", :re_rule => { :key => "value" }
140
140
  end
141
141
 
142
142
  describe "re_rule invalid" do
@@ -175,7 +175,7 @@ describe ReRulesController do
175
175
  end
176
176
 
177
177
  describe "edit" do
178
- it_should_require_rules_engine_editor_access(:edit)
178
+ it_should_require_rules_engine_editor_access(:edit, :re_pipeline_id => 1001, :re_rule_id => 2002)
179
179
 
180
180
  it "should assign the re_pipeline" do
181
181
  get :edit, :re_pipeline_id => 1001, :re_rule_id => 2002
@@ -195,21 +195,21 @@ describe ReRulesController do
195
195
  response.should render_template(:error)
196
196
  end
197
197
  end
198
-
198
+
199
199
  it "should render the 'edit' template" do
200
200
  get :edit, :re_pipeline_id => 1001, :re_rule_id => 2002
201
201
  response.should render_template(:edit)
202
202
  end
203
203
  end
204
-
204
+
205
205
  describe "update" do
206
206
  before(:each) do
207
207
  @re_rule.stub!(:rule_attributes=)
208
208
  @re_rule.stub!(:valid?).and_return(true)
209
209
  @re_rule.stub!(:save).and_return(true)
210
210
  end
211
-
212
- it_should_require_rules_engine_editor_access(:update)
211
+
212
+ it_should_require_rules_engine_editor_access(:update, :re_pipeline_id => 1001, :re_rule_id => 2002, :re_rule => { })
213
213
 
214
214
  it "should assign the re_pipeline" do
215
215
  put :update, :re_pipeline_id => 1001, :re_rule_id => 2002, :re_rule => { :key => "value" }
@@ -229,7 +229,7 @@ describe ReRulesController do
229
229
  response.should render_template(:error)
230
230
  end
231
231
  end
232
-
232
+
233
233
  describe "rule class found" do
234
234
  it "should assign the rule attributes" do
235
235
  @re_rule.should_receive(:rule_attributes=).with(hash_including("re_pipeline_id" => "1001", "re_rule_id" => "2002", "re_rule" => { "key" => "value" }))
@@ -276,7 +276,7 @@ describe ReRulesController do
276
276
  @re_rule.stub!(:destroy).and_return(true)
277
277
  end
278
278
 
279
- it_should_require_rules_engine_editor_access(:destroy)
279
+ it_should_require_rules_engine_editor_access(:destroy, :re_pipeline_id => 1001, :re_rule_id => 2002)
280
280
 
281
281
  it "should assign the re_pipeline" do
282
282
  delete :destroy, :re_pipeline_id => 1001, :re_rule_id => 2002
@@ -288,7 +288,7 @@ describe ReRulesController do
288
288
  delete :destroy, :re_pipeline_id => 1001, :re_rule_id => 2002
289
289
  assigns[:re_rule].should == @re_rule
290
290
  end
291
-
291
+
292
292
  it "should destroy the re_rule" do
293
293
  @re_rule.should_receive(:destroy)
294
294
  delete :destroy, :re_pipeline_id => 1001, :re_rule_id => 2002
@@ -298,12 +298,12 @@ describe ReRulesController do
298
298
  delete :destroy, :re_pipeline_id => 1001, :re_rule_id => 2002
299
299
  flash[:success].should_not be_blank
300
300
  end
301
-
301
+
302
302
  it "should redirect to the change re_pipeline page for HTML" do
303
303
  delete :destroy, :re_pipeline_id => 1001, :re_rule_id => 2002
304
304
  response.should redirect_to(change_re_pipeline_path(@re_pipeline))
305
305
  end
306
-
306
+
307
307
  it "should render 'destroy' template for JAVASCRIPT" do
308
308
  xhr :delete, :destroy, :re_pipeline_id => 1001, :re_rule_id => 2002
309
309
  response.should render_template(:destroy)
@@ -315,7 +315,7 @@ describe ReRulesController do
315
315
  @re_rule.stub!(:move_higher).and_return(true)
316
316
  end
317
317
 
318
- it_should_require_rules_engine_editor_access(:move_up)
318
+ it_should_require_rules_engine_editor_access(:move_up, :re_pipeline_id => 1001, :re_rule_id => 2002)
319
319
 
320
320
  it "should assign the re_pipeline" do
321
321
  put :move_up, :re_pipeline_id => 1001, :re_rule_id => 2002
@@ -327,7 +327,7 @@ describe ReRulesController do
327
327
  put :move_up, :re_pipeline_id => 1001, :re_rule_id => 2002
328
328
  assigns[:re_rule].should == @re_rule
329
329
  end
330
-
330
+
331
331
  it "should call move_higher for the re_rule" do
332
332
  @re_rule.should_receive(:move_higher)
333
333
  put :move_up, :re_pipeline_id => 1001, :re_rule_id => 2002
@@ -337,24 +337,24 @@ describe ReRulesController do
337
337
  put :move_up, :re_pipeline_id => 1001, :re_rule_id => 2002
338
338
  flash[:success].should_not be_blank
339
339
  end
340
-
340
+
341
341
  it "should redirect to the change re_pipeline page for HTML" do
342
342
  put :move_up, :re_pipeline_id => 1001, :re_rule_id => 2002
343
343
  response.should redirect_to(change_re_pipeline_path(@re_pipeline))
344
344
  end
345
-
345
+
346
346
  it "should render 'update' template for JAVASCRIPT" do
347
347
  xhr :put, :move_up, :re_pipeline_id => 1001, :re_rule_id => 2002
348
348
  response.should render_template(:update)
349
349
  end
350
350
  end
351
-
351
+
352
352
  describe "move_down" do
353
353
  before(:each) do
354
354
  @re_rule.stub!(:move_lower).and_return(true)
355
355
  end
356
356
 
357
- it_should_require_rules_engine_editor_access(:move_down)
357
+ it_should_require_rules_engine_editor_access(:move_down, :re_pipeline_id => 1001, :re_rule_id => 2002)
358
358
 
359
359
  it "should assign the re_pipeline" do
360
360
  put :move_down, :re_pipeline_id => 1001, :re_rule_id => 2002
@@ -366,7 +366,7 @@ describe ReRulesController do
366
366
  put :move_down, :re_pipeline_id => 1001, :re_rule_id => 2002
367
367
  assigns[:re_rule].should == @re_rule
368
368
  end
369
-
369
+
370
370
  it "should call move_lower for the re_rule" do
371
371
  @re_rule.should_receive(:move_lower)
372
372
  put :move_down, :re_pipeline_id => 1001, :re_rule_id => 2002
@@ -376,12 +376,12 @@ describe ReRulesController do
376
376
  put :move_down, :re_pipeline_id => 1001, :re_rule_id => 2002
377
377
  flash[:success].should_not be_blank
378
378
  end
379
-
379
+
380
380
  it "should redirect to the change re_pipeline page for HTML" do
381
381
  put :move_down, :re_pipeline_id => 1001, :re_rule_id => 2002
382
382
  response.should redirect_to(change_re_pipeline_path(@re_pipeline))
383
383
  end
384
-
384
+
385
385
  it "should render 'update' template for JAVASCRIPT" do
386
386
  xhr :put, :move_down, :re_pipeline_id => 1001, :re_rule_id => 2002
387
387
  response.should render_template(:update)
@@ -109,7 +109,7 @@ describe RePipelinesController do
109
109
  end
110
110
 
111
111
  describe "show" do
112
- it_should_require_rules_engine_reader_access(:show)
112
+ it_should_require_rules_engine_reader_access(:show, :id => 123)
113
113
 
114
114
  it "should get the pipeline record with the ID" do
115
115
  re_pipeline = mock_model(RePipeline)
@@ -120,7 +120,7 @@ describe RePipelinesController do
120
120
  end
121
121
 
122
122
  describe "new" do
123
- it_should_require_rules_engine_editor_access(:new)
123
+ it_should_require_rules_engine_editor_access(:new, :id => 123)
124
124
 
125
125
  it "should assign a new pipeline record" do
126
126
  re_pipeline = mock_model(RePipeline)
@@ -136,7 +136,7 @@ describe RePipelinesController do
136
136
  end
137
137
 
138
138
  describe "create" do
139
- it_should_require_rules_engine_editor_access(:create)
139
+ it_should_require_rules_engine_editor_access(:create, :re_pipeline => {})
140
140
 
141
141
  before do
142
142
  @re_pipeline = mock_model(RePipeline, :save => false)
@@ -183,7 +183,7 @@ describe RePipelinesController do
183
183
  end
184
184
 
185
185
  describe "change" do
186
- it_should_require_rules_engine_editor_access(:change)
186
+ it_should_require_rules_engine_editor_access(:change, :id => 123)
187
187
 
188
188
  it "should get the pipeline record with the ID" do
189
189
  re_pipeline = mock_model(RePipeline)
@@ -194,7 +194,7 @@ describe RePipelinesController do
194
194
  end
195
195
 
196
196
  describe "edit" do
197
- it_should_require_rules_engine_editor_access(:edit)
197
+ it_should_require_rules_engine_editor_access(:edit, :id => 123)
198
198
 
199
199
  it "should get the pipeline record with the ID" do
200
200
  re_pipeline = mock_model(RePipeline)
@@ -205,7 +205,7 @@ describe RePipelinesController do
205
205
  end
206
206
 
207
207
  describe "update" do
208
- it_should_require_rules_engine_editor_access(:update)
208
+ it_should_require_rules_engine_editor_access(:update, :id => 123, :re_pipeline => {})
209
209
 
210
210
  before do
211
211
  @re_pipeline = mock_model(RePipeline, :save => false)
@@ -304,7 +304,7 @@ describe RePipelinesController do
304
304
  end
305
305
 
306
306
  describe "activate" do
307
- it_should_require_rules_engine_editor_access(:activate)
307
+ it_should_require_rules_engine_editor_access(:activate, :id => 123)
308
308
 
309
309
  before do
310
310
  @re_pipeline = mock_model(RePipeline)
@@ -340,7 +340,7 @@ describe RePipelinesController do
340
340
  end
341
341
 
342
342
  describe "deactivate" do
343
- it_should_require_rules_engine_editor_access(:deactivate)
343
+ it_should_require_rules_engine_editor_access(:deactivate, :id => 123)
344
344
 
345
345
  before do
346
346
  @re_pipeline = mock_model(RePipeline)
@@ -376,7 +376,7 @@ describe RePipelinesController do
376
376
  end
377
377
 
378
378
  describe "revert" do
379
- it_should_require_rules_engine_editor_access(:revert)
379
+ it_should_require_rules_engine_editor_access(:revert, :id => 123)
380
380
 
381
381
  before do
382
382
  @re_pipeline = mock_model(RePipeline)
@@ -412,7 +412,7 @@ describe RePipelinesController do
412
412
  end
413
413
 
414
414
  describe "destroy" do
415
- it_should_require_rules_engine_editor_access(:destroy)
415
+ it_should_require_rules_engine_editor_access(:destroy, :id => 123)
416
416
 
417
417
  before do
418
418
  @re_pipeline = mock_model(RePipeline)
@@ -1,23 +1,16 @@
1
1
  module RulesEngineMacros
2
2
 
3
- def it_should_require_admin_access(action)
4
- it "should require admin access for #{action}" do
5
- controller.should_receive(:admin_access_required)
6
- get action
7
- end
8
- end
9
-
10
- def it_should_require_rules_engine_reader_access(action)
11
- it "should require rules engine reader access for #{action}" do
3
+ def it_should_require_rules_engine_reader_access(*action)
4
+ it "should require rules engine reader access for #{action[0]}" do
12
5
  controller.should_receive(:rules_engine_reader_access_required)
13
- get action
6
+ get *action
14
7
  end
15
8
  end
16
9
 
17
- def it_should_require_rules_engine_editor_access(action)
18
- it "should require rules engine editor access for #{action}" do
10
+ def it_should_require_rules_engine_editor_access(*action)
11
+ it "should require rules engine editor access for #{action[0]}" do
19
12
  controller.should_receive(:rules_engine_editor_access_required)
20
- get action
13
+ get *action
21
14
  end
22
15
  end
23
16
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rules_engine
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Douglas
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-22 00:00:00 +10:00
18
+ date: 2010-06-23 00:00:00 +10:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -71,8 +71,8 @@ files:
71
71
  - rails_generators/rules_engine_generator.rb
72
72
  - rails_generators/templates/app/controllers/re_jobs_controller.rb
73
73
  - rails_generators/templates/app/controllers/re_pipeline_jobs_controller.rb
74
+ - rails_generators/templates/app/controllers/re_pipeline_rules_controller.rb
74
75
  - rails_generators/templates/app/controllers/re_pipelines_controller.rb
75
- - rails_generators/templates/app/controllers/re_rules_controller.rb
76
76
  - rails_generators/templates/app/helpers/re_pipeline_helper.rb
77
77
  - rails_generators/templates/app/models/re_job.rb
78
78
  - rails_generators/templates/app/models/re_job_audit.rb
@@ -95,6 +95,26 @@ files:
95
95
  - rails_generators/templates/app/views/re_jobs/show.js.erb
96
96
  - rails_generators/templates/app/views/re_pipeline_jobs/index.html.erb
97
97
  - rails_generators/templates/app/views/re_pipeline_jobs/index.js.erb
98
+ - rails_generators/templates/app/views/re_pipeline_rules/_change.html.erb
99
+ - rails_generators/templates/app/views/re_pipeline_rules/_edit.html.erb
100
+ - rails_generators/templates/app/views/re_pipeline_rules/_empty.html.erb
101
+ - rails_generators/templates/app/views/re_pipeline_rules/_empty.js.erb
102
+ - rails_generators/templates/app/views/re_pipeline_rules/_error.html.erb
103
+ - rails_generators/templates/app/views/re_pipeline_rules/_help.html.erb
104
+ - rails_generators/templates/app/views/re_pipeline_rules/_index.html.erb
105
+ - rails_generators/templates/app/views/re_pipeline_rules/_menu.html.erb
106
+ - rails_generators/templates/app/views/re_pipeline_rules/_new.html.erb
107
+ - rails_generators/templates/app/views/re_pipeline_rules/_show.html.erb
108
+ - rails_generators/templates/app/views/re_pipeline_rules/destroy.js.erb
109
+ - rails_generators/templates/app/views/re_pipeline_rules/edit.html.erb
110
+ - rails_generators/templates/app/views/re_pipeline_rules/edit.js.erb
111
+ - rails_generators/templates/app/views/re_pipeline_rules/error.html.erb
112
+ - rails_generators/templates/app/views/re_pipeline_rules/error.js.erb
113
+ - rails_generators/templates/app/views/re_pipeline_rules/help.html.erb
114
+ - rails_generators/templates/app/views/re_pipeline_rules/help.js.erb
115
+ - rails_generators/templates/app/views/re_pipeline_rules/new.html.erb
116
+ - rails_generators/templates/app/views/re_pipeline_rules/new.js.erb
117
+ - rails_generators/templates/app/views/re_pipeline_rules/update.js.erb
98
118
  - rails_generators/templates/app/views/re_pipelines/_change.html.erb
99
119
  - rails_generators/templates/app/views/re_pipelines/_change_actions.html.erb
100
120
  - rails_generators/templates/app/views/re_pipelines/_confirm.html.erb
@@ -126,26 +146,6 @@ files:
126
146
  - rails_generators/templates/app/views/re_rule_definitions/simple_rule/_form.html.erb
127
147
  - rails_generators/templates/app/views/re_rule_definitions/simple_rule/_help.html.erb
128
148
  - rails_generators/templates/app/views/re_rule_definitions/simple_rule/_new.html.erb
129
- - rails_generators/templates/app/views/re_rules/_change.html.erb
130
- - rails_generators/templates/app/views/re_rules/_edit.html.erb
131
- - rails_generators/templates/app/views/re_rules/_empty.html.erb
132
- - rails_generators/templates/app/views/re_rules/_empty.js.erb
133
- - rails_generators/templates/app/views/re_rules/_error.html.erb
134
- - rails_generators/templates/app/views/re_rules/_help.html.erb
135
- - rails_generators/templates/app/views/re_rules/_index.html.erb
136
- - rails_generators/templates/app/views/re_rules/_menu.html.erb
137
- - rails_generators/templates/app/views/re_rules/_new.html.erb
138
- - rails_generators/templates/app/views/re_rules/_show.html.erb
139
- - rails_generators/templates/app/views/re_rules/destroy.js.erb
140
- - rails_generators/templates/app/views/re_rules/edit.html.erb
141
- - rails_generators/templates/app/views/re_rules/edit.js.erb
142
- - rails_generators/templates/app/views/re_rules/error.html.erb
143
- - rails_generators/templates/app/views/re_rules/error.js.erb
144
- - rails_generators/templates/app/views/re_rules/help.html.erb
145
- - rails_generators/templates/app/views/re_rules/help.js.erb
146
- - rails_generators/templates/app/views/re_rules/new.html.erb
147
- - rails_generators/templates/app/views/re_rules/new.js.erb
148
- - rails_generators/templates/app/views/re_rules/update.js.erb
149
149
  - rails_generators/templates/db/migrate/20100308225008_create_re_pipelines.rb
150
150
  - rails_generators/templates/doc/README.rules_engine
151
151
  - rails_generators/templates/doc/README.rules_engine_features
@@ -408,8 +408,8 @@ files:
408
408
  - rails_generators/templates/public/stylesheets/rules_engine/re_rule_class/new-48.png
409
409
  - rails_generators/templates/spec/controllers/re_jobs_controller_spec.rb
410
410
  - rails_generators/templates/spec/controllers/re_pipeline_jobs_controller_spec.rb
411
+ - rails_generators/templates/spec/controllers/re_pipeline_rules_controller_spec.rb
411
412
  - rails_generators/templates/spec/controllers/re_pipelines_controller_spec.rb
412
- - rails_generators/templates/spec/controllers/re_rules_controller_spec.rb
413
413
  - rails_generators/templates/spec/helpers/re_pipeline_helper_spec.rb
414
414
  - rails_generators/templates/spec/lib/rules/complex_rule_spec.rb
415
415
  - rails_generators/templates/spec/lib/rules/simple_rule_spec.rb