rails_workflow 0.7.1 → 0.7.2
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.
- checksums.yaml +4 -4
- data/app/models/rails_workflow/process.rb +1 -1
- data/app/serializers/rails_workflow/process_template_serializer.rb +1 -1
- data/app/services/rails_workflow/default_importer_preprocessor.rb +1 -0
- data/db/migrate/20150630174700_create_workflow_processes.rb +1 -1
- data/lib/rails_workflow/version.rb +1 -1
- data/spec/controllers/rails_workflow/operation_templates_controller_spec.rb +48 -34
- data/spec/controllers/rails_workflow/process_templates_controller_spec.rb +31 -18
- data/spec/controllers/rails_workflow/processes_controller_spec.rb +29 -19
- data/spec/dummy/db/migrate/20150127171613_devise_create_users.rb +1 -1
- data/spec/dummy/db/migrate/20150130042852_create_sales_contacts.rb +1 -1
- data/spec/dummy/db/migrate/20150130043008_create_leads.rb +1 -1
- data/spec/dummy/db/schema.rb +87 -94
- data/spec/dummy/log/test.log +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-y/-yP0WN66grJeNzOLblWxb1YEe7Uh6nRoeKAVq6eV5cI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/0K/0KW8A2-oHgfWiGlY1qXC_1XuU9sgSc84l0R_k4lo-R0.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/0P/0PofAOgtV8u136aLIgNVNNYbVjB3jyMcHXt4DkTf-lg.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2D/2DQzNXWutOXG85Y2tWAP7ip49x8pgXsddxpmbrFmNzY.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2y/2yPp5r70PAheOL1JP5JtBOyb_Eynavkjx5KDLEr7ZIQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/3T/3TGL03zNzbwSPNXNOAcRiVGA97b_ot8W5xl1pS0i2pM.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4L/4LGJOVDbB8Zdx2QXqpqG0ACRWsZu-BNcVwACewZHw1g.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4Z/4Z5j7DmWUEoyvwdFpMjqw_ekEHYHqtRvLlv3fcG9r6Q.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/63/63c-YEaSLN__amgnoEUCOp7jW5ZV6viSBHgH_caeAIc.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/6P/6PwUfYtDjXEpmNEanib0x3HRVFm9QE3yhSSs6rKIN2o.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/6u/6u1CApVRbvkLXv7dyShDWFhnfms3PbGfx2fGuVY1njg.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7N/7Nyz34h2EkOynYzidI6hQxu4MUWzTB9qci-nMa6Bbno.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Av/AvAiXS_Os_pK0QHxQvBR_gGxIyEaIR1D6S0FmeDpqNc.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/CP/CPWYjMaHLAtl0p3wMxZ2QZUPNlJESmDs8F_iUDrIwTo.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Dm/DmmfrCpXtt74Hr6NO54lxyOCDv6klnDyBqeDFR7oDU8.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Dn/Dn9nfbKsZf4mkct7gWLtd_WpFKTSSy0Q7PbR5xeps48.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Gq/GqAIXwOwkxqr43GxfaMxdNLSGVoM6ZQ8N55FHLVoiks.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/HW/HWckq3suZuacx_vpXkNXc7ycbMCpDmwwrG_yWwYYWUQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/I2/I2rhxh5aDmyUpTFqSpegw8dUfndAjwV6ZXRtvpUU2nA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/IB/IBit6ykj8M8trJJ7seOksNEIFFouCmhvCfbUNGrvME0.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ig/IgT9vZcopJdxhtKPKBoJyibVxP5sveGwzY1k_C_Ypns.cache +5 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Iu/IuGMXwwQW5jBuD_j2UzS-u8y9viU3BNLcJ29jc3d16c.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/JD/JDzw-3Rf7GQdypuRj1w1shlPhHsXkieMJ4XyC4lhuLY.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ml/MlrGcMlihMqbNvhvLizSA4gSabOIPM91ahUnC4Tb_ZI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Nv/NvKP3t5o4GUA42UkRuui3R73Jka8qqzgltXhFs4LkZo.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/O8/O8akbUwAbmIKY-AhITimq-JDQ6IgsO3Hvq2v5etufFw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/OL/OLW-LBBb0M4fLiDs2TLFoB992GFPOcdG9yyUrOQ1cuw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/O_/O_8-bAiiNpMDRcJBF82E8ZLVZqVJOx32Qu3sGZwzDa4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Pp/PpgmXgc5nbujBgyYL1O1Eua8t-xi-Pub9j27B4GI_zo.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Q4/Q40L8I1uqvkU85AmyoVGDcW4CwYgVL1qrNfXGdtyIzY.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Qn/QnLguEVskMzYLVPMYn14Rr97tRwvg6hCHgLF8Xptim0.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/R3/R3FCjZU5ZcQeIlCAVlDyPkMu_wDlEMNZm4VgIMvEbis.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/T2/T2IXbAqCNxRMPSacUjTGQgPPsFYpram9L7NSJLceFh4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Td/TdhHQNYRwEbnVqoiqOclH8J3k9xkoy5_AZe_nApq-HQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/VL/VL-8YDwAvHtbtfkdHcUvuvXuCNTh8YyhjnX60i2d38c.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/XT/XTb4nPZdZRJNFmpTix61eG9jlDB7EC03-yOKbCP-gw8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/XY/XYt_814EEsuonqqWN9jqZRmD01K6VErvIAK0oeBVfl8.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Xa/XaCpwU8tPWLbYy22GUfy0nJwhZKrB5amr6rGeTHCTLM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/aE/aEfejW1R9hFSjLVs0c2uDmKigf-c6vJFDBlxOd_IMZI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/aT/aTcVvpsQiorD1A8L-2zR3Z_xpv6N_kFm4bUyHdQJi-Y.cache +4 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/bm/bmiSt2fdz3UYJCUc8udeasyk2fdq9X7AAlRC2XF9y6I.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/bo/boeF1gM2g4j4kRab6BefHw72S8DaW5U9YuCGi6sTE4E.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/bw/bwWCHVbMHAMRrpHAyQkzal-EzVy7JVXMSsIOrCxwT6Q.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/cD/cD_F8mE5JipnLEgKF8UIdEbDwJEiyK5ZBwTMd1dP394.cache +5 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/cw/cwwxQvVXbsMXLFxhX9-IzusCxww5izIZlBQPbWgh5MQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gB/gBsQO9vzukwby5U6yYHPpP_difqP836ni70qJe4BFMg.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gZ/gZlCWlR9HzjnHaWyMeMoG9H3HuUGx19cjPVQFW2viKo.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gg/ggjTwQLSDe-BlbQSRsXaP6tgzb4W2HaUCtzilBtZq5k.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gl/gl73RrXxLIv0VdFbytBjCIRGvW56ByGD-QDlzTlmv_g.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hj/hj8Ir9wcVSy1KYrnWu9bpD24vDhCG3tvt-nKbNxb1Wg.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/iB/iBAUgPIEiCQ8rD3-e5U5qr3HwrgbNStLjKNxr9tF0sM.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/jh/jhMQFt_K902TwWegZm1FJuntPsQzO9TFUTsKwRwxm7I.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/k3/k3LMpZ7GuSLQARkF-PAxmHyIJN98PNxO-n1k99gYIBw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/kC/kC_8-tKK7YGZWX5Qqd3VQN_PwiS3KboodvkDG5aql7Y.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/l7/l7MJ4Nx6J7HtkLaVuuH-UEkY_7d7V9XgCSHIAWfEbfo.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ln/ln_99KHeUnBxbY1kbNFoIo9l_41pGXY5yg8N2Z5mFbw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/o8/o8u5a_3dapGtwpJHRk-lzKLR2Ge3QO62xlGLa4lqoLY.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oC/oCsZTGZyV4kH8Y4OeSDUdrwfkJFPzTODZjuBKZB8oGQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oN/oN4VeYD9C_w-J0IiAm2B8pPUGYXvI09uhDhdNcBN3iM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pM/pMla-2766QdChhguQz-DPSKK4A7cWByaH3IDI2M52lU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/r4/r4pVIK6_7WRPFDs5Xl7x4h7gpiHlZqO5A1TI2nhm-Yo.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/s0/s0gW-gR2uiQnOlE-1I2plnhk0MASG-bQUzHsx0i-u-8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/tP/tPF6H9NRpGO3whu2y5_e_R_1EACKdCwu5437D83qJT0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ut/utVWTJyn2pu2gUiiXdAhx8qm29czyctQxkgfHxGYXqA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vk/vkmK1haX-wfcoSmhotSxDARyhpHKY9lYo0nC4rgfqiQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xS/xSYylBQ_dmUa_u-oILbaAgna13HNirKN_Kg0MQu9KsA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/y3/y3BPztIjdmssS92HzcgHAPPa8fI5bctxJwvUtt6WWQM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ya/yatiO0gUaXGtS69lBdE00NzChpP5ZsltcaeNXbCi58w.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zx/zxDaZg9NsqiR-kOlKKsEttfGkPGqv0LQLAY-B0PFh1g.cache +0 -0
- data/spec/serializers/process_template_serializer_spec.rb +6 -3
- metadata +102 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9d9c8eaa468d96c673e8c20fe12be01411823ad7
|
|
4
|
+
data.tar.gz: 8da87c13b5663694330a10cd7f3d477088ffd392
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 70fb5d1821f378b3d16db02930ee8dba499ecb2fea1bc2b8334048abf4a92655fbbc63e07730e928d57d4ffd16a3e1e99c83648336af55bac269ba509c1cf74a
|
|
7
|
+
data.tar.gz: c2656ba296717d17d369d3a4aa19039c9abda7ca3141daf8e4f2bde1486185744d2a8b610bdea7fa19ea0cd50d7221a2796ea5ba068e4d982c170930386709b7
|
|
@@ -47,7 +47,7 @@ module RailsWorkflow
|
|
|
47
47
|
# Returns set or operation that not yet completed.
|
|
48
48
|
# Operation complete in DONE, SKIPPED, CANCELED, etc many other statuses
|
|
49
49
|
def uncompleted_operations
|
|
50
|
-
operations
|
|
50
|
+
operations.reject(&:completed?)
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def can_start?
|
|
@@ -19,7 +19,7 @@ module RailsWorkflow
|
|
|
19
19
|
def child_processes
|
|
20
20
|
children = object.operations.map(&:child_process).compact.uniq
|
|
21
21
|
unless children.blank?
|
|
22
|
-
ActiveModel::
|
|
22
|
+
ActiveModel::Serializer::CollectionSerializer.new(
|
|
23
23
|
children,
|
|
24
24
|
each_serializer: ProcessTemplateSerializer
|
|
25
25
|
).as_json
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
module RailsWorkflow
|
|
4
4
|
class DefaultImporterPreprocessor
|
|
5
5
|
def prepare(json)
|
|
6
|
+
# TODO test after update to Rails 5. Also check with subprocesses
|
|
6
7
|
if json['operations']
|
|
7
8
|
json['process_template']['operations'] = json['operations']
|
|
8
9
|
json['process_template'].delete('operation_ids')
|
|
@@ -22,13 +22,11 @@ module RailsWorkflow
|
|
|
22
22
|
skip('Add a hash of attributes invalid for your model')
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
let(:valid_session) {}
|
|
26
|
-
|
|
27
25
|
describe 'GET index' do
|
|
28
26
|
it 'assigns all operation_templates as @operation_templates' do
|
|
29
27
|
operation_template = OperationTemplate.create! valid_attributes
|
|
30
28
|
|
|
31
|
-
get :index, { process_template_id: @template.id }
|
|
29
|
+
get :index, params: { process_template_id: @template.id }
|
|
32
30
|
expect(assigns(:operation_templates)).to eq([operation_template])
|
|
33
31
|
end
|
|
34
32
|
end
|
|
@@ -37,10 +35,10 @@ module RailsWorkflow
|
|
|
37
35
|
it 'assigns the requested operation_template as @operation_template' do
|
|
38
36
|
operation_template = OperationTemplate.create! valid_attributes
|
|
39
37
|
|
|
40
|
-
get :show, {
|
|
38
|
+
get :show, params: {
|
|
41
39
|
process_template_id: @template.id,
|
|
42
40
|
id: operation_template.to_param
|
|
43
|
-
}
|
|
41
|
+
}
|
|
44
42
|
|
|
45
43
|
expect(assigns(:operation_template)).to eq(operation_template)
|
|
46
44
|
end
|
|
@@ -50,7 +48,7 @@ module RailsWorkflow
|
|
|
50
48
|
it 'assigns a new operation_template as @operation_template' do
|
|
51
49
|
template = create(:process_template)
|
|
52
50
|
|
|
53
|
-
get :new, { process_template_id: template.id }
|
|
51
|
+
get :new, params: { process_template_id: template.id }
|
|
54
52
|
expect(assigns(:operation_template)).to be_a_new(OperationTemplate)
|
|
55
53
|
end
|
|
56
54
|
end
|
|
@@ -58,10 +56,10 @@ module RailsWorkflow
|
|
|
58
56
|
describe 'GET edit' do
|
|
59
57
|
it 'assigns the requested operation_template as @operation_template' do
|
|
60
58
|
operation_template = OperationTemplate.create! valid_attributes
|
|
61
|
-
get :edit, {
|
|
59
|
+
get :edit, params: {
|
|
62
60
|
process_template_id: @template.id,
|
|
63
61
|
id: operation_template.to_param
|
|
64
|
-
}
|
|
62
|
+
}
|
|
65
63
|
expect(assigns(:operation_template)).to eq(operation_template)
|
|
66
64
|
end
|
|
67
65
|
end
|
|
@@ -70,10 +68,10 @@ module RailsWorkflow
|
|
|
70
68
|
describe 'with valid params' do
|
|
71
69
|
it 'creates a new OperationTemplate' do
|
|
72
70
|
expect do
|
|
73
|
-
post :create, {
|
|
71
|
+
post :create, params: {
|
|
74
72
|
process_template_id: @template.id,
|
|
75
73
|
operation_template: valid_attributes
|
|
76
|
-
}
|
|
74
|
+
}
|
|
77
75
|
end.to change(OperationTemplate, :count).by(1)
|
|
78
76
|
|
|
79
77
|
expect(@template.operations.count).to eq 1
|
|
@@ -83,40 +81,42 @@ module RailsWorkflow
|
|
|
83
81
|
attrs = valid_attributes
|
|
84
82
|
attrs[:type] = 'RailsWorkflow::CustomOperationTemplate'
|
|
85
83
|
expect do
|
|
86
|
-
post :create, {
|
|
84
|
+
post :create, params: {
|
|
87
85
|
process_template_id: @template.id,
|
|
88
86
|
operation_template: valid_attributes
|
|
89
|
-
}
|
|
87
|
+
}
|
|
90
88
|
end.to change(RailsWorkflow::CustomOperationTemplate, :count).by(1)
|
|
91
89
|
end
|
|
92
90
|
|
|
93
91
|
it 'assigns a newly created operation_template as @operation_template' do
|
|
94
|
-
post :create, {
|
|
92
|
+
post :create, params: {
|
|
95
93
|
process_template_id: @template.id,
|
|
96
94
|
operation_template: valid_attributes
|
|
97
|
-
}
|
|
95
|
+
}
|
|
98
96
|
|
|
99
97
|
# expect(assigns(:operation_template)).to be_a(OperationTemplate)
|
|
100
98
|
# expect(assigns(:operation_template)).to be_persisted
|
|
101
99
|
end
|
|
102
100
|
|
|
103
101
|
it 'redirects to the created operation_template' do
|
|
104
|
-
post :create, {
|
|
102
|
+
post :create, params: {
|
|
105
103
|
process_template_id: @template.id,
|
|
106
104
|
operation_template: valid_attributes
|
|
107
|
-
}
|
|
108
|
-
expect(response).to redirect_to(
|
|
105
|
+
}
|
|
106
|
+
expect(response).to redirect_to(
|
|
107
|
+
process_template_operation_templates_path(@template.id)
|
|
108
|
+
)
|
|
109
109
|
end
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
describe 'with invalid params' do
|
|
113
113
|
it 'assigns a newly created but unsaved operation_template as @operation_template' do
|
|
114
|
-
post :create, { operation_template: invalid_attributes }
|
|
114
|
+
post :create, params: { operation_template: invalid_attributes }
|
|
115
115
|
expect(assigns(:operation_template)).to be_a_new(OperationTemplate)
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
it "re-renders the 'new' template" do
|
|
119
|
-
post :create, { operation_template: invalid_attributes }
|
|
119
|
+
post :create, params: { operation_template: invalid_attributes }
|
|
120
120
|
expect(response).to render_template('new')
|
|
121
121
|
end
|
|
122
122
|
end
|
|
@@ -130,7 +130,10 @@ module RailsWorkflow
|
|
|
130
130
|
|
|
131
131
|
it 'updates the requested operation_template' do
|
|
132
132
|
operation_template = OperationTemplate.create! valid_attributes
|
|
133
|
-
put :update,
|
|
133
|
+
put :update, params: {
|
|
134
|
+
id: operation_template.to_param,
|
|
135
|
+
operation_template: new_attributes
|
|
136
|
+
}
|
|
134
137
|
operation_template.reload
|
|
135
138
|
skip('Add assertions for updated state')
|
|
136
139
|
end
|
|
@@ -138,10 +141,11 @@ module RailsWorkflow
|
|
|
138
141
|
it 'assigns the requested operation_template as @operation_template' do
|
|
139
142
|
operation_template = OperationTemplate.create! valid_attributes
|
|
140
143
|
|
|
141
|
-
put :update,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
put :update, params: {
|
|
145
|
+
process_template_id: @template.id,
|
|
146
|
+
id: operation_template.to_param,
|
|
147
|
+
operation_template: valid_attributes
|
|
148
|
+
}
|
|
145
149
|
|
|
146
150
|
# expect(assigns(:operations)).to eq([operation_template])
|
|
147
151
|
end
|
|
@@ -149,26 +153,34 @@ module RailsWorkflow
|
|
|
149
153
|
it 'redirects to the operation_template' do
|
|
150
154
|
operation_template = OperationTemplate.create! valid_attributes
|
|
151
155
|
|
|
152
|
-
put :update, {
|
|
156
|
+
put :update, params: {
|
|
153
157
|
process_template_id: @template.id,
|
|
154
158
|
id: operation_template.to_param,
|
|
155
159
|
operation_template: valid_attributes
|
|
156
|
-
}
|
|
160
|
+
}
|
|
157
161
|
|
|
158
|
-
expect(response).to redirect_to(
|
|
162
|
+
expect(response).to redirect_to(
|
|
163
|
+
process_template_operation_templates_path(@template.id)
|
|
164
|
+
)
|
|
159
165
|
end
|
|
160
166
|
end
|
|
161
167
|
|
|
162
168
|
describe 'with invalid params' do
|
|
163
169
|
it 'assigns the operation_template as @operation_template' do
|
|
164
170
|
operation_template = OperationTemplate.create! valid_attributes
|
|
165
|
-
put :update,
|
|
171
|
+
put :update, params: {
|
|
172
|
+
id: operation_template.to_param,
|
|
173
|
+
operation_template: invalid_attributes
|
|
174
|
+
}
|
|
166
175
|
expect(assigns(:operation_template)).to eq(operation_template)
|
|
167
176
|
end
|
|
168
177
|
|
|
169
178
|
it "re-renders the 'edit' template" do
|
|
170
179
|
operation_template = OperationTemplate.create! valid_attributes
|
|
171
|
-
put :update,
|
|
180
|
+
put :update, params: {
|
|
181
|
+
id: operation_template.to_param,
|
|
182
|
+
operation_template: invalid_attributes
|
|
183
|
+
}
|
|
172
184
|
expect(response).to render_template('edit')
|
|
173
185
|
end
|
|
174
186
|
end
|
|
@@ -178,20 +190,22 @@ module RailsWorkflow
|
|
|
178
190
|
it 'destroys the requested operation_template' do
|
|
179
191
|
operation_template = OperationTemplate.create! valid_attributes
|
|
180
192
|
expect do
|
|
181
|
-
delete :destroy, {
|
|
193
|
+
delete :destroy, params: {
|
|
182
194
|
process_template_id: operation_template.process_template.id,
|
|
183
195
|
id: operation_template.to_param
|
|
184
|
-
}
|
|
196
|
+
}
|
|
185
197
|
end.to change(OperationTemplate, :count).by(-1)
|
|
186
198
|
end
|
|
187
199
|
|
|
188
200
|
it 'redirects to the operation_templates list' do
|
|
189
201
|
operation_template = OperationTemplate.create! valid_attributes
|
|
190
|
-
delete :destroy, {
|
|
202
|
+
delete :destroy, params: {
|
|
191
203
|
process_template_id: @template.id,
|
|
192
204
|
id: operation_template.to_param
|
|
193
|
-
}
|
|
194
|
-
expect(response).to redirect_to(
|
|
205
|
+
}
|
|
206
|
+
expect(response).to redirect_to(
|
|
207
|
+
process_template_operation_templates_path(@template)
|
|
208
|
+
)
|
|
195
209
|
end
|
|
196
210
|
end
|
|
197
211
|
end
|
|
@@ -14,12 +14,10 @@ module RailsWorkflow
|
|
|
14
14
|
skip('Add a hash of attributes invalid for your model')
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
let(:valid_session) { {} }
|
|
18
|
-
|
|
19
17
|
describe 'GET index' do
|
|
20
18
|
it 'assigns all process_templates as @process_templates' do
|
|
21
19
|
process_template = ProcessTemplate.create! valid_attributes
|
|
22
|
-
get :index
|
|
20
|
+
get :index
|
|
23
21
|
expect(assigns(:process_templates)).to eq([process_template])
|
|
24
22
|
end
|
|
25
23
|
end
|
|
@@ -27,14 +25,14 @@ module RailsWorkflow
|
|
|
27
25
|
describe 'GET show' do
|
|
28
26
|
it 'assigns the requested process_template as @process_template' do
|
|
29
27
|
process_template = ProcessTemplate.create! valid_attributes
|
|
30
|
-
get :show, { id: process_template.to_param }
|
|
28
|
+
get :show, params: { id: process_template.to_param }
|
|
31
29
|
expect(assigns(:process_template)).to eq(process_template)
|
|
32
30
|
end
|
|
33
31
|
end
|
|
34
32
|
|
|
35
33
|
describe 'GET new' do
|
|
36
34
|
it 'assigns a new process_template as @process_template' do
|
|
37
|
-
get :new
|
|
35
|
+
get :new
|
|
38
36
|
expect(assigns(:process_template)).to be_a_new(ProcessTemplate)
|
|
39
37
|
end
|
|
40
38
|
end
|
|
@@ -42,7 +40,7 @@ module RailsWorkflow
|
|
|
42
40
|
describe 'GET edit' do
|
|
43
41
|
it 'assigns the requested process_template as @process_template' do
|
|
44
42
|
process_template = ProcessTemplate.create! valid_attributes
|
|
45
|
-
get :edit, { id: process_template.to_param }
|
|
43
|
+
get :edit, params: { id: process_template.to_param }
|
|
46
44
|
expect(assigns(:process_template)).to eq(process_template)
|
|
47
45
|
end
|
|
48
46
|
end
|
|
@@ -51,30 +49,30 @@ module RailsWorkflow
|
|
|
51
49
|
describe 'with valid params' do
|
|
52
50
|
it 'creates a new WfProcessTemplate' do
|
|
53
51
|
expect do
|
|
54
|
-
post :create, { process_template: valid_attributes }
|
|
52
|
+
post :create, params: { process_template: valid_attributes }
|
|
55
53
|
end.to change(ProcessTemplate, :count).by(1)
|
|
56
54
|
end
|
|
57
55
|
|
|
58
56
|
it 'assigns a newly created process_template as @process_template' do
|
|
59
|
-
post :create, { process_template: valid_attributes }
|
|
57
|
+
post :create, params: { process_template: valid_attributes }
|
|
60
58
|
expect(assigns(:process_template)).to be_a(ProcessTemplate)
|
|
61
59
|
expect(assigns(:process_template)).to be_persisted
|
|
62
60
|
end
|
|
63
61
|
|
|
64
62
|
it 'redirects to the created process_template' do
|
|
65
|
-
post :create, { process_template: valid_attributes }
|
|
63
|
+
post :create, params: { process_template: valid_attributes }
|
|
66
64
|
expect(response).to redirect_to(process_template_operation_templates_path(ProcessTemplate.last))
|
|
67
65
|
end
|
|
68
66
|
end
|
|
69
67
|
|
|
70
68
|
describe 'with invalid params' do
|
|
71
69
|
it 'assigns a newly created but unsaved process_template as @process_template' do
|
|
72
|
-
post :create, { process_template: invalid_attributes }
|
|
70
|
+
post :create, params: { process_template: invalid_attributes }
|
|
73
71
|
expect(assigns(:process_template)).to be_a_new(ProcessTemplate)
|
|
74
72
|
end
|
|
75
73
|
|
|
76
74
|
it "re-renders the 'new' template" do
|
|
77
|
-
post :create, { process_template: invalid_attributes }
|
|
75
|
+
post :create, params: { process_template: invalid_attributes }
|
|
78
76
|
expect(response).to render_template('new')
|
|
79
77
|
end
|
|
80
78
|
end
|
|
@@ -88,20 +86,29 @@ module RailsWorkflow
|
|
|
88
86
|
|
|
89
87
|
it 'updates the requested process_template' do
|
|
90
88
|
process_template = ProcessTemplate.create! valid_attributes
|
|
91
|
-
put :update,
|
|
89
|
+
put :update, params: {
|
|
90
|
+
id: process_template.to_param,
|
|
91
|
+
process_template: new_attributes
|
|
92
|
+
}
|
|
92
93
|
process_template.reload
|
|
93
94
|
skip('Add assertions for updated state')
|
|
94
95
|
end
|
|
95
96
|
|
|
96
97
|
it 'assigns the requested process_template as @process_template' do
|
|
97
98
|
process_template = ProcessTemplate.create! valid_attributes
|
|
98
|
-
put :update,
|
|
99
|
+
put :update, params: {
|
|
100
|
+
id: process_template.to_param,
|
|
101
|
+
process_template: valid_attributes
|
|
102
|
+
}
|
|
99
103
|
expect(assigns(:process_template)).to eq(process_template)
|
|
100
104
|
end
|
|
101
105
|
|
|
102
106
|
it 'redirects to the process_template' do
|
|
103
107
|
process_template = ProcessTemplate.create! valid_attributes
|
|
104
|
-
put :update,
|
|
108
|
+
put :update, params: {
|
|
109
|
+
id: process_template.to_param,
|
|
110
|
+
process_template: valid_attributes
|
|
111
|
+
}
|
|
105
112
|
expect(response).to redirect_to(process_template)
|
|
106
113
|
end
|
|
107
114
|
end
|
|
@@ -109,13 +116,19 @@ module RailsWorkflow
|
|
|
109
116
|
describe 'with invalid params' do
|
|
110
117
|
it 'assigns the process_template as @process_template' do
|
|
111
118
|
process_template = ProcessTemplate.create! valid_attributes
|
|
112
|
-
put :update,
|
|
119
|
+
put :update, params: {
|
|
120
|
+
id: process_template.to_param,
|
|
121
|
+
process_template: invalid_attributes
|
|
122
|
+
}
|
|
113
123
|
expect(assigns(:process_template)).to eq(process_template)
|
|
114
124
|
end
|
|
115
125
|
|
|
116
126
|
it "re-renders the 'edit' template" do
|
|
117
127
|
process_template = ProcessTemplate.create! valid_attributes
|
|
118
|
-
put :update,
|
|
128
|
+
put :update, params: {
|
|
129
|
+
id: process_template.to_param,
|
|
130
|
+
process_template: invalid_attributes
|
|
131
|
+
}
|
|
119
132
|
expect(response).to render_template('edit')
|
|
120
133
|
end
|
|
121
134
|
end
|
|
@@ -125,13 +138,13 @@ module RailsWorkflow
|
|
|
125
138
|
it 'destroys the requested process_template' do
|
|
126
139
|
process_template = ProcessTemplate.create! valid_attributes
|
|
127
140
|
expect do
|
|
128
|
-
delete :destroy, { id: process_template.to_param }
|
|
141
|
+
delete :destroy, params: { id: process_template.to_param }
|
|
129
142
|
end.to change(ProcessTemplate, :count).by(-1)
|
|
130
143
|
end
|
|
131
144
|
|
|
132
145
|
it 'redirects to the process_templates list' do
|
|
133
146
|
process_template = ProcessTemplate.create! valid_attributes
|
|
134
|
-
delete :destroy, { id: process_template.to_param }
|
|
147
|
+
delete :destroy, params: { id: process_template.to_param }
|
|
135
148
|
expect(response).to redirect_to(process_templates_url)
|
|
136
149
|
end
|
|
137
150
|
end
|
|
@@ -21,35 +21,33 @@ module RailsWorkflow
|
|
|
21
21
|
skip('Add a hash of attributes invalid for your model')
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
let(:valid_session) { {} }
|
|
25
|
-
|
|
26
24
|
describe 'GET index' do
|
|
27
25
|
it 'assigns all processes as @processes' do
|
|
28
|
-
process = Process.create! valid_attributes
|
|
29
|
-
get :index
|
|
26
|
+
process = RailsWorkflow::Process.create! valid_attributes
|
|
27
|
+
get :index
|
|
30
28
|
expect(assigns(:processes)).to eq([process])
|
|
31
29
|
end
|
|
32
30
|
end
|
|
33
31
|
|
|
34
32
|
describe 'GET show' do
|
|
35
33
|
it 'assigns the requested process as @process' do
|
|
36
|
-
process = Process.create! valid_attributes
|
|
37
|
-
get :show, { id: process.to_param }
|
|
34
|
+
process = RailsWorkflow::Process.create! valid_attributes
|
|
35
|
+
get :show, params: { id: process.to_param }
|
|
38
36
|
expect(assigns(:process)).to eq(process)
|
|
39
37
|
end
|
|
40
38
|
end
|
|
41
39
|
|
|
42
40
|
describe 'GET new' do
|
|
43
41
|
it 'assigns a new process as @process' do
|
|
44
|
-
get :new
|
|
42
|
+
get :new
|
|
45
43
|
expect(assigns(:process)).to be_a_new(Process)
|
|
46
44
|
end
|
|
47
45
|
end
|
|
48
46
|
|
|
49
47
|
describe 'GET edit' do
|
|
50
48
|
it 'assigns the requested process as @process' do
|
|
51
|
-
process = Process.create! valid_attributes
|
|
52
|
-
get :edit, { id: process.to_param }
|
|
49
|
+
process = RailsWorkflow::Process.create! valid_attributes
|
|
50
|
+
get :edit, params: { id: process.to_param }
|
|
53
51
|
expect(assigns(:process)).to eq(process)
|
|
54
52
|
end
|
|
55
53
|
end
|
|
@@ -58,30 +56,30 @@ module RailsWorkflow
|
|
|
58
56
|
describe 'with valid params' do
|
|
59
57
|
it 'creates a new WfProcess' do
|
|
60
58
|
expect do
|
|
61
|
-
post :create, { process: valid_attributes }
|
|
59
|
+
post :create, params: { process: valid_attributes }
|
|
62
60
|
end.to change(RailsWorkflow::Process, :count).by(1)
|
|
63
61
|
end
|
|
64
62
|
|
|
65
63
|
it 'assigns a newly created process as @process' do
|
|
66
|
-
post :create, { process: valid_attributes }
|
|
64
|
+
post :create, params: { process: valid_attributes }
|
|
67
65
|
expect(assigns(:process)).to be_a(Process)
|
|
68
66
|
expect(assigns(:process)).to be_persisted
|
|
69
67
|
end
|
|
70
68
|
|
|
71
69
|
it 'redirects to the created process' do
|
|
72
|
-
post :create, { process: valid_attributes }
|
|
70
|
+
post :create, params: { process: valid_attributes }
|
|
73
71
|
expect(response).to redirect_to(Process.last)
|
|
74
72
|
end
|
|
75
73
|
end
|
|
76
74
|
|
|
77
75
|
describe 'with invalid params' do
|
|
78
76
|
it 'assigns a newly created but unsaved process as @process' do
|
|
79
|
-
post :create, { process: invalid_attributes }
|
|
77
|
+
post :create, params: { process: invalid_attributes }
|
|
80
78
|
expect(assigns(:process)).to be_a_new(Process)
|
|
81
79
|
end
|
|
82
80
|
|
|
83
81
|
it "re-renders the 'new' template" do
|
|
84
|
-
post :create, { process: invalid_attributes }
|
|
82
|
+
post :create, params: { process: invalid_attributes }
|
|
85
83
|
expect(response).to render_template('new')
|
|
86
84
|
end
|
|
87
85
|
end
|
|
@@ -95,20 +93,26 @@ module RailsWorkflow
|
|
|
95
93
|
|
|
96
94
|
it 'updates the requested process' do
|
|
97
95
|
process = Process.create! valid_attributes
|
|
98
|
-
put :update, { id: process.to_param, process: new_attributes }
|
|
96
|
+
put :update, params: { id: process.to_param, process: new_attributes }
|
|
99
97
|
process.reload
|
|
100
98
|
skip('Add assertions for updated state')
|
|
101
99
|
end
|
|
102
100
|
|
|
103
101
|
it 'assigns the requested process as @process' do
|
|
104
102
|
process = Process.create! valid_attributes
|
|
105
|
-
put :update,
|
|
103
|
+
put :update, params: {
|
|
104
|
+
id: process.to_param,
|
|
105
|
+
process: valid_attributes
|
|
106
|
+
}
|
|
106
107
|
expect(assigns(:process)).to eq(process)
|
|
107
108
|
end
|
|
108
109
|
|
|
109
110
|
it 'redirects to the process' do
|
|
110
111
|
process = Process.create! valid_attributes
|
|
111
|
-
put :update,
|
|
112
|
+
put :update, params: {
|
|
113
|
+
id: process.to_param,
|
|
114
|
+
process: valid_attributes
|
|
115
|
+
}
|
|
112
116
|
expect(response).to redirect_to(processes_path)
|
|
113
117
|
end
|
|
114
118
|
end
|
|
@@ -116,13 +120,19 @@ module RailsWorkflow
|
|
|
116
120
|
describe 'with invalid params' do
|
|
117
121
|
it 'assigns the process as @process' do
|
|
118
122
|
process = Process.create! valid_attributes
|
|
119
|
-
put :update,
|
|
123
|
+
put :update, params: {
|
|
124
|
+
id: process.to_param,
|
|
125
|
+
process: invalid_attributes
|
|
126
|
+
}
|
|
120
127
|
expect(assigns(:process)).to eq(process)
|
|
121
128
|
end
|
|
122
129
|
|
|
123
130
|
it "re-renders the 'edit' template" do
|
|
124
131
|
process = Process.create! valid_attributes
|
|
125
|
-
put :update,
|
|
132
|
+
put :update, params: {
|
|
133
|
+
id: process.to_param,
|
|
134
|
+
process: invalid_attributes
|
|
135
|
+
}
|
|
126
136
|
expect(response).to render_template('edit')
|
|
127
137
|
end
|
|
128
138
|
end
|