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
@@ -35,14 +35,12 @@ describe RePlansController do
|
|
35
35
|
it_should_require_rules_engine_editor_access(:new, :id => 123)
|
36
36
|
|
37
37
|
it "should assign a new plan record" do
|
38
|
-
|
39
|
-
|
40
|
-
get :new, :id => 123
|
41
|
-
assigns[:re_plan].should == re_plan
|
38
|
+
get :new
|
39
|
+
assigns[:re_plan].should be_instance_of(RePlan)
|
42
40
|
end
|
43
41
|
|
44
42
|
it "should render the 'new' template" do
|
45
|
-
get :new
|
43
|
+
get :new
|
46
44
|
response.should render_template(:new)
|
47
45
|
end
|
48
46
|
end
|
@@ -103,8 +101,7 @@ describe RePlansController do
|
|
103
101
|
|
104
102
|
it "should get the plan record with the ID" do
|
105
103
|
re_plan = RePlan.make
|
106
|
-
|
107
|
-
get :edit, :id => 123
|
104
|
+
get :edit, :id => re_plan.id
|
108
105
|
assigns[:re_plan].should == re_plan
|
109
106
|
end
|
110
107
|
end
|
@@ -114,7 +111,6 @@ describe RePlansController do
|
|
114
111
|
|
115
112
|
before do
|
116
113
|
@re_plan = RePlan.make
|
117
|
-
RePlan.stub!(:find).and_return(@re_plan)
|
118
114
|
end
|
119
115
|
|
120
116
|
it "should get the plan record with the ID" do
|
@@ -124,48 +120,43 @@ describe RePlansController do
|
|
124
120
|
end
|
125
121
|
|
126
122
|
it "should assign the re_plan parameters" do
|
123
|
+
RePlan.stub!(:find).and_return(@re_plan)
|
127
124
|
@re_plan.should_receive(:attributes=).with("title" => "name")
|
128
|
-
put :update, :id =>
|
125
|
+
put :update, :id => @re_plan.id, :re_plan => { :title => "name" }
|
129
126
|
end
|
130
127
|
|
131
128
|
it "should not assign the re_plan parameters :code" do
|
129
|
+
RePlan.stub!(:find).and_return(@re_plan)
|
132
130
|
@re_plan.should_receive(:attributes=).with("title" => "name")
|
133
|
-
put :update, :id =>
|
131
|
+
put :update, :id => @re_plan.id, :re_plan => { :title => "name", :code => "code" }
|
134
132
|
end
|
135
133
|
|
136
134
|
it "should save the re_plan" do
|
137
|
-
@re_plan.
|
138
|
-
|
135
|
+
put :update, :id => @re_plan.id, :re_plan => { :title => "new name" }
|
136
|
+
@re_plan.reload
|
137
|
+
@re_plan.title.should == 'new name'
|
139
138
|
end
|
140
139
|
|
141
140
|
describe "save failed" do
|
142
|
-
before(:each) do
|
143
|
-
@re_plan.stub!(:save).and_return(false)
|
144
|
-
end
|
145
|
-
|
146
141
|
it "should render the 'edit' template" do
|
147
|
-
put :update, :id =>
|
142
|
+
put :update, :id => @re_plan.id, :re_plan => { :title => "" }
|
148
143
|
response.should render_template(:edit)
|
149
144
|
end
|
150
145
|
end
|
151
146
|
|
152
147
|
describe "save succeeded" do
|
153
|
-
before do
|
154
|
-
@re_plan.stub!(:save).and_return(true)
|
155
|
-
end
|
156
|
-
|
157
148
|
it "should display a flash success message" do
|
158
|
-
put :update, :id =>
|
149
|
+
put :update, :id => @re_plan.id, :re_plan => { :title => "name" }
|
159
150
|
flash[:success].should_not be_blank
|
160
151
|
end
|
161
152
|
|
162
153
|
it "should redirect to the change re_plan page for HTML" do
|
163
|
-
put :update, :id =>
|
154
|
+
put :update, :id => @re_plan.id, :re_plan => { :title => "name" }
|
164
155
|
response.should redirect_to(change_re_plan_path(@re_plan))
|
165
156
|
end
|
166
157
|
|
167
158
|
it "should render 'update' template for JAVASCRIPT" do
|
168
|
-
xhr :put, :update, :id =>
|
159
|
+
xhr :put, :update, :id => @re_plan.id, :re_plan => { :title => "name" }
|
169
160
|
response.should render_template(:update)
|
170
161
|
end
|
171
162
|
end
|
@@ -211,8 +202,7 @@ describe RePlansController do
|
|
211
202
|
|
212
203
|
it "should get the plan record with the ID" do
|
213
204
|
re_plan = RePlan.make
|
214
|
-
|
215
|
-
get :change, :id => 123
|
205
|
+
get :change, :id => re_plan.id
|
216
206
|
assigns[:re_plan].should == re_plan
|
217
207
|
end
|
218
208
|
end
|
@@ -222,8 +212,7 @@ describe RePlansController do
|
|
222
212
|
|
223
213
|
it "should get the plan record with the ID" do
|
224
214
|
re_plan = RePlan.make
|
225
|
-
|
226
|
-
get :preview, :id => 123
|
215
|
+
get :preview, :id => re_plan.id
|
227
216
|
assigns[:re_plan].should == re_plan
|
228
217
|
end
|
229
218
|
end
|
@@ -277,201 +266,154 @@ describe RePlansController do
|
|
277
266
|
response.should render_template(:update)
|
278
267
|
end
|
279
268
|
end
|
280
|
-
|
269
|
+
|
270
|
+
describe "revert" do
|
271
|
+
it_should_require_rules_engine_editor_access(:revert, :id => 123)
|
272
|
+
|
273
|
+
before do
|
274
|
+
@publisher = mock('publisher')
|
275
|
+
@publisher.stub!(:get)
|
276
|
+
RulesEngine::Publish.stub!(:publisher).and_return(@publisher)
|
277
|
+
|
278
|
+
@re_plan = RePlan.make
|
279
|
+
RePlan.stub!(:find).and_return(@re_plan)
|
280
|
+
end
|
281
|
+
|
282
|
+
it "should get the plan record with the ID" do
|
283
|
+
RePlan.should_receive(:find).with("123").and_return(@re_plan)
|
284
|
+
put :revert, :id => 123
|
285
|
+
assigns[:re_plan].should == @re_plan
|
286
|
+
end
|
287
|
+
|
288
|
+
it "should get the plan from the publisher" do
|
289
|
+
@publisher.should_receive(:get).with(@re_plan.code)
|
290
|
+
put :revert, :id => 123
|
291
|
+
end
|
292
|
+
|
293
|
+
describe "the publisher does not have the plan" do
|
294
|
+
it "should set an error message" do
|
295
|
+
put :revert, :id => 123
|
296
|
+
flash[:error].should_not be_blank
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
describe "the publisher has the plan" do
|
301
|
+
before(:each) do
|
302
|
+
@plan = {:code => 'mock plan'}
|
303
|
+
@publisher.stub!(:get).and_return(@plan)
|
304
|
+
@publisher.stub!(:revert!)
|
305
|
+
@re_plan.stub!(:save!)
|
306
|
+
end
|
307
|
+
|
308
|
+
it "should revert the plan" do
|
309
|
+
@re_plan.should_receive(:revert!).with(@plan)
|
310
|
+
put :revert, :id => 123
|
311
|
+
end
|
312
|
+
|
313
|
+
it "should save the plan" do
|
314
|
+
@re_plan.should_receive(:save!)
|
315
|
+
put :revert, :id => 123
|
316
|
+
end
|
317
|
+
|
318
|
+
it "should display a flash success message" do
|
319
|
+
put :revert, :id => 123
|
320
|
+
flash[:success].should_not be_blank
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
it "should redirect to the change re_plan page for HTML" do
|
325
|
+
put :revert, :id => 123
|
326
|
+
response.should redirect_to(change_re_plan_path(@re_plan))
|
327
|
+
end
|
328
|
+
|
329
|
+
it "should render 'update' template for JAVASCRIPT" do
|
330
|
+
xhr :put, :revert, :id => 123
|
331
|
+
response.should render_template(:update)
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
describe "history" do
|
336
|
+
it_should_require_rules_engine_reader_access(:history, :id => 123)
|
337
|
+
|
338
|
+
it "should get the process runner history from the rules engine process runner" do
|
339
|
+
re_plan = RePlan.make(:code => "mock_code")
|
340
|
+
|
341
|
+
runner = mock('runner')
|
342
|
+
RulesEngine::Process.stub!(:runner).and_return(runner)
|
343
|
+
|
344
|
+
re_history = {:history => "none"}
|
345
|
+
runner.should_receive(:history).with("mock_code", anything()).and_return(re_history)
|
346
|
+
get :history, :id => re_plan.id
|
347
|
+
assigns[:re_history].should == re_history
|
348
|
+
end
|
349
|
+
end
|
281
350
|
|
351
|
+
describe "copy" do
|
352
|
+
it_should_require_rules_engine_editor_access(:copy, :id => 123)
|
353
|
+
|
354
|
+
before(:each) do
|
355
|
+
@re_plan = RePlan.make
|
356
|
+
end
|
357
|
+
|
358
|
+
it "should assign an empty plan copy" do
|
359
|
+
get :copy, :id => @re_plan.id
|
360
|
+
assigns[:re_plan].should == @re_plan
|
361
|
+
assigns[:re_plan_copy].should be_instance_of(RePlan)
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
describe "duplicate" do
|
366
|
+
it_should_require_rules_engine_editor_access(:duplicate, :id => 123)
|
282
367
|
|
368
|
+
before(:each) do
|
369
|
+
@re_plan = RePlan.make
|
370
|
+
RePlan.stub!(:find).and_return(@re_plan)
|
371
|
+
|
372
|
+
@re_plan_copy = RePlan.make
|
373
|
+
RePlan.stub!(:new).and_return(@re_plan_copy)
|
374
|
+
end
|
375
|
+
|
376
|
+
it "should use the revert and publish method to copy the parameters" do
|
377
|
+
@re_plan.should_receive(:publish).and_return({:published => "mock value"})
|
378
|
+
@re_plan_copy.should_receive(:revert!).with({:published => "mock value"})
|
379
|
+
post :duplicate, :id => 1234, :re_plan => {:title => 'new title'}
|
380
|
+
end
|
381
|
+
|
382
|
+
it "should update the attributes of the new plan" do
|
383
|
+
post :duplicate, :id => 1234, :re_plan => {:title => 'new title'}
|
384
|
+
@re_plan_copy.title.should == 'new title'
|
385
|
+
end
|
386
|
+
|
387
|
+
describe "the copied plan was saved" do
|
388
|
+
before(:each) do
|
389
|
+
@re_plan_copy.stub!(:save).and_return(true)
|
390
|
+
end
|
391
|
+
|
392
|
+
it "should display a flash success message" do
|
393
|
+
post :duplicate, :id => 1234, :re_plan => {:title => 'new title'}
|
394
|
+
flash[:success].should_not be_blank
|
395
|
+
end
|
396
|
+
|
397
|
+
it "should redirect to the change re_plan page for HTML" do
|
398
|
+
post :duplicate, :id => 1234, :re_plan => {:title => 'new title'}
|
399
|
+
response.should redirect_to(change_re_plan_path(@re_plan_copy))
|
400
|
+
end
|
401
|
+
|
402
|
+
it "should redirect to the change re_plans page for JAVASCRIPT" do
|
403
|
+
xhr :post, :duplicate, :id => 1234, :re_plan => {:title => 'new title'}
|
404
|
+
response.body.should == "window.location.href = '#{change_re_plan_path(@re_plan_copy)}';"
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
describe "the copied plan was not saved" do
|
409
|
+
before(:each) do
|
410
|
+
@re_plan_copy.stub!(:save).and_return(false)
|
411
|
+
end
|
283
412
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
# @re_plan_2 = mock_model(RePlan)
|
292
|
-
# @re_plan_2.stub!(:plan_error).and_return(nil)
|
293
|
-
# @re_plan_2.stub!(:activate!)
|
294
|
-
# RePlan.stub!(:find).and_return([@re_plan_1, @re_plan_2])
|
295
|
-
# end
|
296
|
-
#
|
297
|
-
# it "should get the all of the plans" do
|
298
|
-
# RePlan.should_receive(:find).with(:all).and_return([@re_plan_1, @re_plan_2])
|
299
|
-
# put :activate_all
|
300
|
-
# assigns[:re_plans].should == [@re_plan_1, @re_plan_2]
|
301
|
-
# end
|
302
|
-
#
|
303
|
-
# describe "no errors in the plans" do
|
304
|
-
# it "should activate all of the re_plan" do
|
305
|
-
# @re_plan_1.should_receive(:activate!)
|
306
|
-
# @re_plan_2.should_receive(:activate!)
|
307
|
-
# put :activate_all
|
308
|
-
# end
|
309
|
-
#
|
310
|
-
# it "should display a flash success message" do
|
311
|
-
# put :activate_all
|
312
|
-
# flash[:success].should_not be_blank
|
313
|
-
# end
|
314
|
-
# end
|
315
|
-
#
|
316
|
-
# describe "one of the plans has errors" do
|
317
|
-
# before(:each) do
|
318
|
-
# @re_plan_2.stub!(:plan_error).and_return("you bet")
|
319
|
-
# @re_plan_2.stub!(:plan_error).and_return("you bet")
|
320
|
-
# end
|
321
|
-
#
|
322
|
-
# it "should stop checking at the first invalid plan" do
|
323
|
-
# @re_plan_1.should_receive(:plan_error).and_return("you bet")
|
324
|
-
# @re_plan_2.should_not_receive(:plan_error)
|
325
|
-
# put :activate_all
|
326
|
-
# end
|
327
|
-
#
|
328
|
-
# it "should not activate the plans" do
|
329
|
-
# @re_plan_1.should_not_receive(:activate!)
|
330
|
-
# @re_plan_2.should_not_receive(:activate!)
|
331
|
-
# put :activate_all
|
332
|
-
# end
|
333
|
-
#
|
334
|
-
# it "should display a flash error message" do
|
335
|
-
# put :activate_all
|
336
|
-
# flash[:error].should_not be_blank
|
337
|
-
# end
|
338
|
-
# end
|
339
|
-
#
|
340
|
-
# it "should redirect to the re_plan index page for HTML" do
|
341
|
-
# put :activate_all
|
342
|
-
# response.should redirect_to(re_plans_path)
|
343
|
-
# end
|
344
|
-
#
|
345
|
-
# it "should render 'index' template for JAVASCRIPT" do
|
346
|
-
# xhr :put, :activate_all
|
347
|
-
# response.should render_template(:index)
|
348
|
-
# end
|
349
|
-
# end
|
350
|
-
#
|
351
|
-
# describe "activate" do
|
352
|
-
# it_should_require_rules_engine_editor_access(:activate, :id => 123)
|
353
|
-
#
|
354
|
-
# before do
|
355
|
-
# @re_plan = mock_model(RePlan)
|
356
|
-
# @re_plan.stub!(:plan_error).and_return(nil)
|
357
|
-
# @re_plan.stub!(:activate!)
|
358
|
-
# RePlan.stub!(:find).and_return(@re_plan)
|
359
|
-
# end
|
360
|
-
#
|
361
|
-
# it "should get the plan record with the ID" do
|
362
|
-
# RePlan.should_receive(:find).with("123").and_return(@re_plan)
|
363
|
-
# put :activate, :id => 123
|
364
|
-
# assigns[:re_plan].should == @re_plan
|
365
|
-
# end
|
366
|
-
#
|
367
|
-
# describe "the plan is valid" do
|
368
|
-
# it "should activate the re_plan" do
|
369
|
-
# @re_plan.should_receive(:activate!)
|
370
|
-
# put :activate, :id => 123
|
371
|
-
# end
|
372
|
-
#
|
373
|
-
# it "should display a flash success message" do
|
374
|
-
# put :activate, :id => 123
|
375
|
-
# flash[:success].should_not be_blank
|
376
|
-
# end
|
377
|
-
# end
|
378
|
-
#
|
379
|
-
# describe "the plan is invalid" do
|
380
|
-
# before(:each) do
|
381
|
-
# @re_plan.stub!(:plan_error).and_return("you bet")
|
382
|
-
# end
|
383
|
-
#
|
384
|
-
# it "should not activate the plan" do
|
385
|
-
# @re_plan.should_not_receive(:activate!)
|
386
|
-
# put :activate, :id => 123
|
387
|
-
# end
|
388
|
-
#
|
389
|
-
# it "should display a flash error message" do
|
390
|
-
# put :activate, :id => 123
|
391
|
-
# flash[:error].should_not be_blank
|
392
|
-
# end
|
393
|
-
# end
|
394
|
-
#
|
395
|
-
# it "should redirect to the change re_plan page for HTML" do
|
396
|
-
# put :activate, :id => 123
|
397
|
-
# response.should redirect_to(change_re_plan_path(@re_plan))
|
398
|
-
# end
|
399
|
-
#
|
400
|
-
# it "should render 'update' template for JAVASCRIPT" do
|
401
|
-
# xhr :put, :activate, :id => 123
|
402
|
-
# response.should render_template(:update)
|
403
|
-
# end
|
404
|
-
# end
|
405
|
-
#
|
406
|
-
# describe "deactivate" do
|
407
|
-
# it_should_require_rules_engine_editor_access(:deactivate, :id => 123)
|
408
|
-
#
|
409
|
-
# before do
|
410
|
-
# @re_plan = mock_model(RePlan)
|
411
|
-
# @re_plan.stub!(:deactivate!)
|
412
|
-
# RePlan.stub!(:find).and_return(@re_plan)
|
413
|
-
# end
|
414
|
-
#
|
415
|
-
# it "should get the plan record with the ID" do
|
416
|
-
# RePlan.should_receive(:find).with("123").and_return(@re_plan)
|
417
|
-
# put :deactivate, :id => 123
|
418
|
-
# assigns[:re_plan].should == @re_plan
|
419
|
-
# end
|
420
|
-
#
|
421
|
-
# it "should deactivate the re_plan" do
|
422
|
-
# @re_plan.should_receive(:deactivate!)
|
423
|
-
# put :deactivate, :id => 123
|
424
|
-
# end
|
425
|
-
#
|
426
|
-
# it "should display a flash success message" do
|
427
|
-
# put :deactivate, :id => 123
|
428
|
-
# flash[:success].should_not be_blank
|
429
|
-
# end
|
430
|
-
#
|
431
|
-
# it "should redirect to the change re_plan page for HTML" do
|
432
|
-
# put :deactivate, :id => 123
|
433
|
-
# response.should redirect_to(change_re_plan_path(@re_plan))
|
434
|
-
# end
|
435
|
-
#
|
436
|
-
# it "should render 'update' template for JAVASCRIPT" do
|
437
|
-
# xhr :put, :deactivate, :id => 123
|
438
|
-
# response.should render_template(:update)
|
439
|
-
# end
|
440
|
-
# end
|
441
|
-
#
|
442
|
-
# describe "revert" do
|
443
|
-
# it_should_require_rules_engine_editor_access(:revert, :id => 123)
|
444
|
-
#
|
445
|
-
# before do
|
446
|
-
# @re_plan = mock_model(RePlan)
|
447
|
-
# @re_plan.stub!(:revert!)
|
448
|
-
# RePlan.stub!(:find).and_return(@re_plan)
|
449
|
-
# end
|
450
|
-
#
|
451
|
-
# it "should get the plan record with the ID" do
|
452
|
-
# RePlan.should_receive(:find).with("123").and_return(@re_plan)
|
453
|
-
# put :revert, :id => 123
|
454
|
-
# assigns[:re_plan].should == @re_plan
|
455
|
-
# end
|
456
|
-
#
|
457
|
-
# it "should revert the re_plan" do
|
458
|
-
# @re_plan.should_receive(:revert!)
|
459
|
-
# put :revert, :id => 123
|
460
|
-
# end
|
461
|
-
#
|
462
|
-
# it "should display a flash success message" do
|
463
|
-
# put :revert, :id => 123
|
464
|
-
# flash[:success].should_not be_blank
|
465
|
-
# end
|
466
|
-
#
|
467
|
-
# it "should redirect to the change re_plan page for HTML" do
|
468
|
-
# put :revert, :id => 123
|
469
|
-
# response.should redirect_to(change_re_plan_path(@re_plan))
|
470
|
-
# end
|
471
|
-
#
|
472
|
-
# it "should render 'update' template for JAVASCRIPT" do
|
473
|
-
# xhr :put, :revert, :id => 123
|
474
|
-
# response.should render_template(:update)
|
475
|
-
# end
|
476
|
-
# end
|
477
|
-
#
|
413
|
+
it "should render the 'copy' template" do
|
414
|
+
post :duplicate, :id => 1234, :re_plan => {:title => 'new title'}
|
415
|
+
response.should render_template(:copy)
|
416
|
+
end
|
417
|
+
end
|
418
|
+
end
|
419
|
+
end
|