rules_engine 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/VERSION +1 -1
  2. data/lib/rules_engine/process/runner.rb +81 -75
  3. data/lib/rules_engine/process/runner/db_runner.rb +2 -2
  4. data/lib/rules_engine/rule/definition.rb +1 -1
  5. data/lib/rules_engine_view/alerts.rb +3 -4
  6. data/lib/rules_engine_view/navigate.rb +2 -2
  7. data/rails_generators/manifests/complex.rb +6 -6
  8. data/rails_generators/manifests/complex.yml +6 -6
  9. data/rails_generators/manifests/simple.rb +5 -5
  10. data/rails_generators/manifests/simple.yml +5 -5
  11. data/rails_generators/templates/app/controllers/re_plans_controller.rb +2 -2
  12. data/rails_generators/templates/app/models/re_plan.rb +7 -2
  13. data/rails_generators/templates/app/models/re_workflow.rb +8 -1
  14. data/rails_generators/templates/app/rules/complex.rb +21 -21
  15. data/rails_generators/templates/app/rules/simple.rb +4 -4
  16. data/rails_generators/templates/app/views/re_plan_workflows/edit.js.erb +2 -0
  17. data/rails_generators/templates/app/views/re_plan_workflows/new.js.erb +2 -0
  18. data/rails_generators/templates/app/views/re_plans/_menu.html.erb +6 -8
  19. data/rails_generators/templates/app/views/re_plans/change.html.erb +1 -0
  20. data/rails_generators/templates/app/views/re_plans/edit.js.erb +2 -0
  21. data/rails_generators/templates/app/views/re_plans/new.js.erb +2 -0
  22. data/rails_generators/templates/app/views/re_rules/complex/_edit.html.erb +1 -0
  23. data/rails_generators/templates/app/views/{re_rule_definitions → re_rules}/complex/_form.html.erb +10 -10
  24. data/rails_generators/templates/app/views/{re_rule_definitions → re_rules}/complex/_form_word.html.erb +1 -1
  25. data/rails_generators/templates/app/views/{re_rule_definitions → re_rules}/complex/_help.html.erb +0 -0
  26. data/rails_generators/templates/app/views/re_rules/complex/_new.html.erb +1 -0
  27. data/rails_generators/templates/app/views/re_rules/simple/_edit.html.erb +1 -0
  28. data/rails_generators/templates/app/views/{re_rule_definitions → re_rules}/simple/_form.html.erb +0 -0
  29. data/rails_generators/templates/app/views/{re_rule_definitions → re_rules}/simple/_help.html.erb +0 -0
  30. data/rails_generators/templates/app/views/re_rules/simple/_new.html.erb +1 -0
  31. data/rails_generators/templates/app/views/re_workflows/edit.js.erb +2 -0
  32. data/rails_generators/templates/app/views/re_workflows/new.js.erb +3 -1
  33. data/rails_generators/templates/lib/tasks/rules_engine.rake +4 -4
  34. data/rails_generators/templates/public/javascripts/rules_engine/re_plan_change.js +13 -1
  35. data/rails_generators/templates/public/stylesheets/rules_engine/screen.css +2 -2
  36. data/rails_generators/templates/spec/controllers/re_plans_controller_spec.rb +0 -8
  37. data/rails_generators/templates/spec/lib/rules/complex_spec.rb +70 -69
  38. data/rails_generators/templates/spec/lib/rules/simple_spec.rb +8 -8
  39. data/rails_generators/templates/spec/models/re_plan_spec.rb +3 -3
  40. data/rails_generators/templates/spec/models/re_rule_spec.rb +14 -19
  41. data/rails_generators/templates/spec/models/re_workflow_spec.rb +9 -0
  42. data/spec/railsenv/log/debug.log +4050 -0
  43. data/spec/railsenv/log/test.log +592 -0
  44. data/spec/rules_engine/process/runner/db_runner_spec.rb +15 -16
  45. data/spec/rules_engine/process/runner_spec.rb +166 -113
  46. data/spec/rules_engine/rule/definition_spec.rb +2 -2
  47. metadata +13 -13
  48. data/rails_generators/templates/app/views/re_rule_definitions/complex/_edit.html.erb +0 -1
  49. data/rails_generators/templates/app/views/re_rule_definitions/complex/_new.html.erb +0 -1
  50. data/rails_generators/templates/app/views/re_rule_definitions/simple/_edit.html.erb +0 -1
  51. data/rails_generators/templates/app/views/re_rule_definitions/simple/_new.html.erb +0 -1
@@ -96,12 +96,12 @@ describe "RulesEngine::Process::DbRunner" do
96
96
 
97
97
  describe "running a plan" do
98
98
  before(:each) do
99
- @plan = {"code" => 'mock_plan', "version" => 1009}
99
+ @plan = {"code" => 'mock_plan', "version" => 1009, "workflow" => "db_runner_workflow"}
100
100
  end
101
101
 
102
102
  it "should get the created process" do
103
103
  RulesEngine::Process::ReProcessRun.should_receive(:find_by_id).with(1009)
104
- RulesEngine::Process.runner.run(1009, @plan, {})
104
+ RulesEngine::Process.runner.run_plan(1009, @plan, {})
105
105
  end
106
106
 
107
107
  describe "process not found" do
@@ -110,65 +110,64 @@ describe "RulesEngine::Process::DbRunner" do
110
110
  end
111
111
 
112
112
  it "should return false" do
113
- RulesEngine::Process.runner.run(1009, @plan, {}).should == false
113
+ RulesEngine::Process.runner.run_plan(1009, @plan, {}).should == false
114
114
  end
115
115
 
116
116
  it "should audit the error" do
117
117
  RulesEngine::Process.auditor.should_receive(:audit).with(1009, "Process missing", RulesEngine::Process::AUDIT_FAILURE)
118
- RulesEngine::Process.runner.run(1009, @plan, {})
118
+ RulesEngine::Process.runner.run_plan(1009, @plan, {})
119
119
  end
120
120
  end
121
121
 
122
122
  describe "updateing the plan" do
123
123
  it "should update the plan code" do
124
124
  @re_process_run.should_receive(:update_attributes).once.with(hash_including(:plan_code => 'mock_plan'))
125
- RulesEngine::Process.runner.run(1009, @plan, {})
125
+ RulesEngine::Process.runner.run_plan(1009, @plan, {})
126
126
  end
127
127
 
128
128
  it "should update the plan version" do
129
129
  @re_process_run.should_receive(:update_attributes).once.with(hash_including(:plan_version => 1009))
130
- RulesEngine::Process.runner.run(1009, @plan, {})
130
+ RulesEngine::Process.runner.run_plan(1009, @plan, {})
131
131
  end
132
132
 
133
133
  it "should update the plan as running" do
134
134
  @re_process_run.should_receive(:update_attributes).once.with(hash_including(:process_status => RulesEngine::Process::PROCESS_STATUS_RUNNING))
135
- RulesEngine::Process.runner.run(1009, @plan, {})
135
+ RulesEngine::Process.runner.run_plan(1009, @plan, {})
136
136
  end
137
137
  end
138
138
 
139
139
  it "should run the plan" do
140
- RulesEngine::Process.runner.should_receive(:_run_plan).with(1009, @plan, {:test => "data"})
141
- RulesEngine::Process.runner.run(1009, @plan, {:test => "data"})
140
+ RulesEngine::Process.runner.should_receive(:_run_plan_workflow).with(1009, @plan, "db_runner_workflow", {:test => "data"})
141
+ RulesEngine::Process.runner.run_plan(1009, @plan, {:test => "data"})
142
142
  end
143
-
144
143
 
145
144
  describe "running the plan was successfull" do
146
145
  before(:each) do
147
- RulesEngine::Process.runner.should_receive(:_run_plan).and_return(true)
146
+ RulesEngine::Process.runner.should_receive(:_run_plan_workflow).and_return(true)
148
147
  end
149
148
 
150
149
  it "should update the status as finished success" do
151
150
  @re_process_run.should_receive(:update_attributes).once.with(hash_including(:process_status => RulesEngine::Process::PROCESS_STATUS_SUCCESS))
152
- RulesEngine::Process.runner.run(1009, @plan, {})
151
+ RulesEngine::Process.runner.run_plan(1009, @plan, {})
153
152
  end
154
153
 
155
154
  it "should return success" do
156
- RulesEngine::Process.runner.run(1009, @plan, {}).should == true
155
+ RulesEngine::Process.runner.run_plan(1009, @plan, {}).should == true
157
156
  end
158
157
  end
159
158
 
160
159
  describe "running the plan failed" do
161
160
  before(:each) do
162
- RulesEngine::Process.runner.should_receive(:_run_plan).and_return(false)
161
+ RulesEngine::Process.runner.should_receive(:_run_plan_workflow).and_return(false)
163
162
  end
164
163
 
165
164
  it "should update the status as failed" do
166
165
  @re_process_run.should_receive(:update_attributes).once.with(hash_including(:process_status => RulesEngine::Process::PROCESS_STATUS_FAILURE))
167
- RulesEngine::Process.runner.run(1009, @plan, {})
166
+ RulesEngine::Process.runner.run_plan(1009, @plan, {})
168
167
  end
169
168
 
170
169
  it "should return failure" do
171
- RulesEngine::Process.runner.run(1009, @plan, {}).should == false
170
+ RulesEngine::Process.runner.run_plan(1009, @plan, {}).should == false
172
171
  end
173
172
  end
174
173
  end
@@ -49,7 +49,7 @@ describe "RulesEngine::Process::Runner" do
49
49
  end
50
50
  end
51
51
 
52
- describe "running the plan" do
52
+ describe "running plans and workflows" do
53
53
  before(:each) do
54
54
  @rule_class = mock("Rule Class")
55
55
  @rule_class.stub!(:new).and_return(@rule_class)
@@ -63,8 +63,9 @@ describe "RulesEngine::Process::Runner" do
63
63
  @runner = RulesEngine::Process::Runner.new
64
64
 
65
65
  @plan = {"code" => "plan_code",
66
- "first_workflow" => "one",
67
-
66
+ "version" => "1001",
67
+ "workflow" => "one",
68
+
68
69
  "workflow_one" => {
69
70
  "rules" => [{
70
71
  "rule_class_name" => "one_one",
@@ -93,144 +94,196 @@ describe "RulesEngine::Process::Runner" do
93
94
  "next_workflow" => ""
94
95
  }
95
96
  }
97
+
96
98
  end
99
+
100
+ describe "running the plan" do
97
101
 
98
- it "should use the _run_plan method" do
99
- @runner.should_receive(:_run_plan)
100
- @runner.run(10001, @plan, {})
101
- end
102
-
103
- it "should be successfull with a valid plan" do
104
- @runner.run(10001, @plan, {}).should == true
105
- end
106
-
107
- it "should audit the plan has started" do
108
- RulesEngine::Process.auditor.should_receive(:audit).once.with(10001, "Plan : plan_code : started", RulesEngine::Process::AUDIT_INFO)
109
- @runner.run(10001, @plan, {})
110
- end
111
-
112
- describe "first_workflow missing" do
113
- it "should audit the failure" do
114
- RulesEngine::Process.auditor.should_receive(:audit).once.with(10001, anything, RulesEngine::Process::AUDIT_FAILURE)
115
- @runner.run(10001, @plan.except("first_workflow"), {})
102
+ it "should use the _run_plan_workflow method" do
103
+ @runner.should_receive(:_run_plan_workflow)
104
+ @runner.run_plan(10001, @plan, {})
116
105
  end
117
-
118
- it "should return false" do
119
- @runner.run(10001, @plan.except("first_workflow"), {}).should == false
120
- end
121
- end
122
106
 
123
- describe "endless loop" do
124
- it "should return false" do
125
- @plan["workflow_one"].merge!("next_workflow" => "one")
126
- @runner.run(10001, @plan, {}).should == false
107
+ it "should be successfull with a valid plan" do
108
+ @runner.run_plan(10001, @plan, {}).should == true
127
109
  end
128
- end
129
-
130
- describe "workflow missing" do
131
- it "should return false" do
132
- @plan["workflow_one"].merge!("next_workflow" => "not_there")
133
- @runner.run(10001, @plan, {}).should == false
110
+
111
+ it "should fail with an invalid plan" do
112
+ @runner.run_plan(10001, {}, {}).should == false
134
113
  end
135
- end
114
+
115
+ it "should audit the plan has started" do
116
+ RulesEngine::Process.auditor.should_receive(:audit).once.with(10001, "Plan : plan_code : started", RulesEngine::Process::AUDIT_INFO)
117
+ @runner.run_plan(10001, @plan, {})
118
+ end
119
+
120
+ describe "run_workflow missing" do
121
+ it "should audit the failure" do
122
+ RulesEngine::Process.auditor.should_receive(:audit).once.with(10001, anything, RulesEngine::Process::AUDIT_FAILURE)
123
+ @runner.run_plan(10001, @plan.except("workflow"), {})
124
+ end
125
+
126
+ it "should return false" do
127
+ @runner.run_plan(10001, @plan.except("workflow"), {}).should == false
128
+ end
129
+ end
136
130
 
137
- describe "processing the workflows" do
138
- it "should process each follow the next_workflow " do
139
- # testing this by checking it runs one rule in each workflow
140
- RulesEngine::Discovery.should_receive(:rule_class).with("one_one").and_return(@rule_class)
141
- RulesEngine::Discovery.should_receive(:rule_class).with("two_one").and_return(@rule_class)
142
- RulesEngine::Discovery.should_receive(:rule_class).with("three_one").and_return(@rule_class)
143
- @runner.run(10001, @plan, {})
131
+ it "should process the workflow " do
132
+ @runner.should_receive(:_run_workflow_rules).with(10001, @plan, @plan["workflow_one"], {:data => "mock data"})
133
+ @runner.run_plan(10001, @plan, {:data => "mock data"})
144
134
  end
145
- end
146
135
 
147
- describe "processing the rules" do
148
- it "should load the rule" do
149
- RulesEngine::Discovery.should_receive(:rule_class).with("one_one").and_return(@rule_class)
150
- @rule_class.should_receive(:new).and_return(@rule_class)
151
- @rule_class.should_receive(:data=).with("one_one_data")
152
- @runner.run(10001, @plan, {}).should == true
153
- end
154
-
155
- describe "the rules does not exist" do
156
- it "should return an error" do
157
- RulesEngine::Discovery.should_receive(:rule_class).with("one_one").and_return(nil)
158
- @runner.run(10001, @plan, {}).should == false
159
- end
160
- end
161
-
162
- it "should proces the rule" do
163
- @rule_class.should_receive(:process)
164
- @runner.run(10001, @plan, {})
165
- end
136
+ describe "_run_workflow_rules outcomes" do
137
+ describe "it returns no outcome" do
138
+ it "should return success" do
139
+ @runner.stub!(:_run_workflow_rules).and_return(nil)
140
+ @runner.run_plan(10001, @plan, {}).should == true
141
+ end
142
+ end
166
143
 
167
- describe "processing a rule" do
168
- before(:each) do
169
- @test_rule = mock("Test Rule")
170
- @test_rule.stub!(:new).and_return(@test_rule)
171
- @test_rule.stub!(:title).and_return('mock title')
172
- @test_rule.stub!(:data=)
173
- RulesEngine::Discovery.stub!(:rule_class).with("one_one").and_return(@test_rule)
144
+ describe "it returns NEXT" do
145
+ it "should return success" do
146
+ @runner.stub!(:_run_workflow_rules).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::NEXT))
147
+ @runner.run_plan(10001, @plan, {}).should == true
148
+ end
174
149
  end
175
-
176
- describe "rule returns nil" do
177
- it "should proceed to the next rule" do
178
- @test_rule.stub!(:process).and_return(nil)
179
- RulesEngine::Discovery.should_receive(:rule_class).with("one_two")
180
- @runner.run(10001, @plan, {})
150
+
151
+ describe "it returns STOP SUCCESS" do
152
+ it "should return success" do
153
+ @runner.stub!(:_run_workflow_rules).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_SUCCESS))
154
+ @runner.run_plan(10001, @plan, {}).should == true
181
155
  end
182
156
  end
183
157
 
184
- describe "rule returns NEXT" do
185
- it "should proceed to the next rule" do
186
- @test_rule.stub!(:process).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::NEXT))
187
- RulesEngine::Discovery.should_receive(:rule_class).with("one_two")
188
- @runner.run(10001, @plan, {})
158
+ describe "it returns STOP FAILURE" do
159
+ it "should return failure" do
160
+ @runner.stub!(:_run_workflow_rules).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_FAILURE))
161
+ @runner.run_plan(10001, @plan, {}).should == false
189
162
  end
190
163
  end
191
-
192
- describe "rule returns STOP_SUCCESS" do
193
- it "should not proceed to the next rule" do
194
- @test_rule.stub!(:process).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_SUCCESS))
195
- RulesEngine::Discovery.should_not_receive(:rule_class).with("one_two")
196
- @runner.run(10001, @plan, {})
164
+
165
+ describe "it returns START_WORKFLOW" do
166
+ it "should return run the next workflow" do
167
+ @runner.should_receive(:_run_workflow_rules).with(10001, @plan, @plan["workflow_one"], {:data => "mock data"}).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::START_WORKFLOW, 'two'))
168
+ @runner.should_receive(:_run_workflow_rules).with(10001, @plan, @plan["workflow_two"], {:data => "mock data"})
169
+ @runner.run_plan(10001, @plan, {:data => "mock data"}).should == true
197
170
  end
171
+ end
198
172
 
199
- it "should return success" do
200
- @test_rule.stub!(:process).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_SUCCESS))
201
- @runner.run(10001, @plan, {}) == true
202
- end
173
+ it "should return false" do
174
+ @runner.stub!(:_run_workflow_rules).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::START_WORKFLOW, 'one'))
175
+ @runner.run_plan(10001, @plan, {}).should == false
176
+ end
177
+ end
178
+
179
+ describe "running the workflow" do
180
+ it "should load the rule" do
181
+ RulesEngine::Discovery.should_receive(:rule_class).with("one_one").and_return(@rule_class)
182
+ @rule_class.should_receive(:new).and_return(@rule_class)
183
+ @rule_class.should_receive(:data=).with("one_one_data")
184
+ @runner.run_plan(10001, @plan, {}).should == true
185
+ end
186
+
187
+ describe "the rules does not exist" do
188
+ it "should return an error" do
189
+ RulesEngine::Discovery.should_receive(:rule_class).with("one_one").and_return(nil)
190
+ @runner.run_plan(10001, @plan, {}).should == false
191
+ end
192
+ end
193
+
194
+ it "should proces the rule" do
195
+ @rule_class.should_receive(:process)
196
+ @runner.run_plan(10001, @plan, {})
203
197
  end
204
198
 
205
- describe "rule returns STOP_FAILURE" do
206
- it "should not proceed to the next rule" do
207
- @test_rule.stub!(:process).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_FAILURE))
208
- RulesEngine::Discovery.should_not_receive(:rule_class).with("one_two")
209
- @runner.run(10001, @plan, {})
199
+ describe "processing a rule" do
200
+ before(:each) do
201
+ @test_rule = mock("Test Rule")
202
+ @test_rule.stub!(:new).and_return(@test_rule)
203
+ @test_rule.stub!(:title).and_return('mock title')
204
+ @test_rule.stub!(:data=)
205
+ RulesEngine::Discovery.stub!(:rule_class).with("one_one").and_return(@test_rule)
206
+ end
207
+
208
+ it "should pass the plan to the process" do
209
+ @test_rule.should_receive(:process).with(10001, @plan, {:plan => "data"})
210
+ @runner.run_plan(10001, @plan, {:plan => "data"})
211
+ end
212
+
213
+ describe "rule returns nil" do
214
+ it "should proceed to the next rule" do
215
+ @test_rule.stub!(:process).and_return(nil)
216
+ RulesEngine::Discovery.should_receive(:rule_class).with("one_two")
217
+ @runner.run_plan(10001, @plan, {})
218
+ end
210
219
  end
211
220
 
212
- it "should return failure" do
213
- @test_rule.stub!(:process).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_FAILURE))
214
- @runner.run(10001, @plan, {}) == false
221
+ describe "rule returns NEXT" do
222
+ it "should proceed to the next rule" do
223
+ @test_rule.stub!(:process).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::NEXT))
224
+ RulesEngine::Discovery.should_receive(:rule_class).with("one_two")
225
+ @runner.run_plan(10001, @plan, {})
226
+ end
215
227
  end
216
- end
217
228
 
218
- describe "rule returns START_WORKFLOW" do
219
- it "should not proceed to the next rule" do
220
- @test_rule.stub!(:process).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::START_WORKFLOW, 'three'))
221
- RulesEngine::Discovery.should_not_receive(:rule_class).with("one_two")
222
- @runner.run(10001, @plan, {})
229
+ describe "rule returns STOP_SUCCESS" do
230
+ it "should not proceed to the next rule" do
231
+ @test_rule.stub!(:process).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_SUCCESS))
232
+ RulesEngine::Discovery.should_not_receive(:rule_class).with("one_two")
233
+ @runner.run_plan(10001, @plan, {})
234
+ end
235
+
236
+ it "should return success" do
237
+ @test_rule.stub!(:process).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_SUCCESS))
238
+ @runner.run_plan(10001, @plan, {}) == true
239
+ end
223
240
  end
224
241
 
225
- it "should start the defined workflow" do
226
- @test_rule.stub!(:process).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::START_WORKFLOW, 'three'))
227
- RulesEngine::Discovery.should_not_receive(:rule_class).with("two_one")
228
- RulesEngine::Discovery.should_receive(:rule_class).with("three_one")
229
- @runner.run(10001, @plan, {})
242
+ describe "rule returns STOP_FAILURE" do
243
+ it "should not proceed to the next rule" do
244
+ @test_rule.stub!(:process).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_FAILURE))
245
+ RulesEngine::Discovery.should_not_receive(:rule_class).with("one_two")
246
+ @runner.run_plan(10001, @plan, {})
247
+ end
248
+
249
+ it "should return failure" do
250
+ @test_rule.stub!(:process).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_FAILURE))
251
+ @runner.run_plan(10001, @plan, {}) == false
252
+ end
230
253
  end
254
+
255
+ describe "rule returns START_WORKFLOW" do
256
+ it "should not proceed to the next rule" do
257
+ @test_rule.stub!(:process).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::START_WORKFLOW, 'three'))
258
+ RulesEngine::Discovery.should_not_receive(:rule_class).with("one_two")
259
+ @runner.run_plan(10001, @plan, {})
260
+ end
261
+
262
+ it "should start the defined workflow" do
263
+ @test_rule.stub!(:process).and_return(RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::START_WORKFLOW, 'three'))
264
+ RulesEngine::Discovery.should_not_receive(:rule_class).with("two_one")
265
+ RulesEngine::Discovery.should_receive(:rule_class).with("three_one")
266
+ @runner.run_plan(10001, @plan, {})
267
+ end
268
+ end
231
269
  end
270
+ end
271
+ end
272
+
273
+ describe "running the workflow" do
274
+ it "should use the _run_plan_workflow method" do
275
+ @runner.should_receive(:_run_plan_workflow)
276
+ @runner.run_workflow(10001, @plan, "one", {})
277
+ end
278
+
279
+ it "should be successfull with a valid plan" do
280
+ @runner.run_workflow(10001, @plan, "one", {}).should == true
281
+ end
282
+
283
+ it "should fail with an invalid plan" do
284
+ @runner.run_workflow(10001, {}, {}).should == false
232
285
  end
233
286
  end
234
- end
235
-
287
+ end
288
+
236
289
  end
@@ -69,11 +69,11 @@ describe "RulesEngine::Rule::Definition" do
69
69
 
70
70
  describe "processing a rule" do
71
71
  it "should return a rule_outcome" do
72
- MockRule.new.process(101, {}).should be_instance_of(RulesEngine::Rule::Outcome)
72
+ MockRule.new.process(101, {}, {}).should be_instance_of(RulesEngine::Rule::Outcome)
73
73
  end
74
74
 
75
75
  it "should set the outcome to NEXT by default" do
76
- MockRule.new.process(101, {}).outcome.should == RulesEngine::Rule::Outcome::NEXT
76
+ MockRule.new.process(101, {}, {}).outcome.should == RulesEngine::Rule::Outcome::NEXT
77
77
  end
78
78
  end
79
79
 
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: 21
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 7
10
- version: 0.1.7
9
+ - 8
10
+ version: 0.1.8
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-07-29 00:00:00 +10:00
18
+ date: 2010-08-09 00:00:00 +10:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -148,15 +148,15 @@ files:
148
148
  - rails_generators/templates/app/views/re_publications/_show_update.html.erb
149
149
  - rails_generators/templates/app/views/re_publications/show.html.erb
150
150
  - rails_generators/templates/app/views/re_publications/show.js.erb
151
- - rails_generators/templates/app/views/re_rule_definitions/complex/_edit.html.erb
152
- - rails_generators/templates/app/views/re_rule_definitions/complex/_form.html.erb
153
- - rails_generators/templates/app/views/re_rule_definitions/complex/_form_word.html.erb
154
- - rails_generators/templates/app/views/re_rule_definitions/complex/_help.html.erb
155
- - rails_generators/templates/app/views/re_rule_definitions/complex/_new.html.erb
156
- - rails_generators/templates/app/views/re_rule_definitions/simple/_edit.html.erb
157
- - rails_generators/templates/app/views/re_rule_definitions/simple/_form.html.erb
158
- - rails_generators/templates/app/views/re_rule_definitions/simple/_help.html.erb
159
- - rails_generators/templates/app/views/re_rule_definitions/simple/_new.html.erb
151
+ - rails_generators/templates/app/views/re_rules/complex/_edit.html.erb
152
+ - rails_generators/templates/app/views/re_rules/complex/_form.html.erb
153
+ - rails_generators/templates/app/views/re_rules/complex/_form_word.html.erb
154
+ - rails_generators/templates/app/views/re_rules/complex/_help.html.erb
155
+ - rails_generators/templates/app/views/re_rules/complex/_new.html.erb
156
+ - rails_generators/templates/app/views/re_rules/simple/_edit.html.erb
157
+ - rails_generators/templates/app/views/re_rules/simple/_form.html.erb
158
+ - rails_generators/templates/app/views/re_rules/simple/_help.html.erb
159
+ - rails_generators/templates/app/views/re_rules/simple/_new.html.erb
160
160
  - rails_generators/templates/app/views/re_workflow_rules/_edit.html.erb
161
161
  - rails_generators/templates/app/views/re_workflow_rules/_error.html.erb
162
162
  - rails_generators/templates/app/views/re_workflow_rules/_help.html.erb