rules_engine 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/rules_engine/process/runner.rb +81 -75
- data/lib/rules_engine/process/runner/db_runner.rb +2 -2
- data/lib/rules_engine/rule/definition.rb +1 -1
- data/lib/rules_engine_view/alerts.rb +3 -4
- data/lib/rules_engine_view/navigate.rb +2 -2
- data/rails_generators/manifests/complex.rb +6 -6
- data/rails_generators/manifests/complex.yml +6 -6
- data/rails_generators/manifests/simple.rb +5 -5
- data/rails_generators/manifests/simple.yml +5 -5
- data/rails_generators/templates/app/controllers/re_plans_controller.rb +2 -2
- data/rails_generators/templates/app/models/re_plan.rb +7 -2
- data/rails_generators/templates/app/models/re_workflow.rb +8 -1
- data/rails_generators/templates/app/rules/complex.rb +21 -21
- data/rails_generators/templates/app/rules/simple.rb +4 -4
- data/rails_generators/templates/app/views/re_plan_workflows/edit.js.erb +2 -0
- data/rails_generators/templates/app/views/re_plan_workflows/new.js.erb +2 -0
- data/rails_generators/templates/app/views/re_plans/_menu.html.erb +6 -8
- data/rails_generators/templates/app/views/re_plans/change.html.erb +1 -0
- data/rails_generators/templates/app/views/re_plans/edit.js.erb +2 -0
- data/rails_generators/templates/app/views/re_plans/new.js.erb +2 -0
- data/rails_generators/templates/app/views/re_rules/complex/_edit.html.erb +1 -0
- data/rails_generators/templates/app/views/{re_rule_definitions → re_rules}/complex/_form.html.erb +10 -10
- data/rails_generators/templates/app/views/{re_rule_definitions → re_rules}/complex/_form_word.html.erb +1 -1
- data/rails_generators/templates/app/views/{re_rule_definitions → re_rules}/complex/_help.html.erb +0 -0
- data/rails_generators/templates/app/views/re_rules/complex/_new.html.erb +1 -0
- data/rails_generators/templates/app/views/re_rules/simple/_edit.html.erb +1 -0
- data/rails_generators/templates/app/views/{re_rule_definitions → re_rules}/simple/_form.html.erb +0 -0
- data/rails_generators/templates/app/views/{re_rule_definitions → re_rules}/simple/_help.html.erb +0 -0
- data/rails_generators/templates/app/views/re_rules/simple/_new.html.erb +1 -0
- data/rails_generators/templates/app/views/re_workflows/edit.js.erb +2 -0
- data/rails_generators/templates/app/views/re_workflows/new.js.erb +3 -1
- data/rails_generators/templates/lib/tasks/rules_engine.rake +4 -4
- data/rails_generators/templates/public/javascripts/rules_engine/re_plan_change.js +13 -1
- data/rails_generators/templates/public/stylesheets/rules_engine/screen.css +2 -2
- data/rails_generators/templates/spec/controllers/re_plans_controller_spec.rb +0 -8
- data/rails_generators/templates/spec/lib/rules/complex_spec.rb +70 -69
- data/rails_generators/templates/spec/lib/rules/simple_spec.rb +8 -8
- data/rails_generators/templates/spec/models/re_plan_spec.rb +3 -3
- data/rails_generators/templates/spec/models/re_rule_spec.rb +14 -19
- data/rails_generators/templates/spec/models/re_workflow_spec.rb +9 -0
- data/spec/railsenv/log/debug.log +4050 -0
- data/spec/railsenv/log/test.log +592 -0
- data/spec/rules_engine/process/runner/db_runner_spec.rb +15 -16
- data/spec/rules_engine/process/runner_spec.rb +166 -113
- data/spec/rules_engine/rule/definition_spec.rb +2 -2
- metadata +13 -13
- data/rails_generators/templates/app/views/re_rule_definitions/complex/_edit.html.erb +0 -1
- data/rails_generators/templates/app/views/re_rule_definitions/complex/_new.html.erb +0 -1
- data/rails_generators/templates/app/views/re_rule_definitions/simple/_edit.html.erb +0 -1
- 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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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(:
|
141
|
-
RulesEngine::Process.runner.
|
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(:
|
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.
|
151
|
+
RulesEngine::Process.runner.run_plan(1009, @plan, {})
|
153
152
|
end
|
154
153
|
|
155
154
|
it "should return success" do
|
156
|
-
RulesEngine::Process.runner.
|
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(:
|
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.
|
166
|
+
RulesEngine::Process.runner.run_plan(1009, @plan, {})
|
168
167
|
end
|
169
168
|
|
170
169
|
it "should return failure" do
|
171
|
-
RulesEngine::Process.runner.
|
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
|
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
|
-
"
|
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
|
-
|
99
|
-
|
100
|
-
|
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
|
-
|
124
|
-
|
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
|
-
|
129
|
-
|
130
|
-
|
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
|
-
|
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
|
-
|
138
|
-
|
139
|
-
|
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
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
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
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
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 "
|
177
|
-
it "should
|
178
|
-
@
|
179
|
-
|
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 "
|
185
|
-
it "should
|
186
|
-
@
|
187
|
-
|
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 "
|
193
|
-
it "should
|
194
|
-
@
|
195
|
-
|
196
|
-
@runner.
|
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
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
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 "
|
206
|
-
|
207
|
-
@test_rule
|
208
|
-
|
209
|
-
@
|
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
|
-
|
213
|
-
|
214
|
-
|
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
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
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
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
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:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
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-
|
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/
|
152
|
-
- rails_generators/templates/app/views/
|
153
|
-
- rails_generators/templates/app/views/
|
154
|
-
- rails_generators/templates/app/views/
|
155
|
-
- rails_generators/templates/app/views/
|
156
|
-
- rails_generators/templates/app/views/
|
157
|
-
- rails_generators/templates/app/views/
|
158
|
-
- rails_generators/templates/app/views/
|
159
|
-
- rails_generators/templates/app/views/
|
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
|