ruote-kit 2.1.10 → 2.1.11
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/CHANGELOG.txt +10 -0
- data/Gemfile +21 -5
- data/LICENSE.txt +20 -0
- data/README.rdoc +132 -80
- data/Rakefile +4 -15
- data/TODO.txt +12 -0
- data/config.ru +22 -14
- data/lib/ruote-kit/application.rb +46 -22
- data/lib/ruote-kit/helpers/json_helpers.rb +280 -0
- data/lib/ruote-kit/helpers/link_helpers.rb +117 -0
- data/lib/ruote-kit/helpers/misc_helpers.rb +35 -0
- data/lib/ruote-kit/helpers/pagination_helpers.rb +30 -0
- data/lib/ruote-kit/helpers/render_helpers.rb +39 -92
- data/lib/ruote-kit/public/_ruote/images/favicon.ico +0 -0
- data/lib/ruote-kit/public/_ruote/images/ruote.png +0 -0
- data/lib/ruote-kit/public/_ruote/images/ruote_buttons.png +0 -0
- data/lib/ruote-kit/public/_ruote/javascripts/jquery-1.4.2.min.js +154 -0
- data/lib/ruote-kit/public/_ruote/javascripts/rk.js +40 -0
- data/lib/ruote-kit/public/_ruote/javascripts/ruote-fluo-editor.js +548 -0
- data/lib/ruote-kit/public/_ruote/javascripts/ruote-fluo.js +32 -1
- data/lib/ruote-kit/public/_ruote/stylesheets/reset.css +53 -0
- data/lib/ruote-kit/public/_ruote/stylesheets/rk.css +355 -16
- data/lib/ruote-kit/public/_ruote/stylesheets/ruote-fluo-editor.css +108 -0
- data/lib/ruote-kit/resources/errors.rb +46 -43
- data/lib/ruote-kit/resources/expressions.rb +92 -35
- data/lib/ruote-kit/resources/participants.rb +53 -0
- data/lib/ruote-kit/resources/processes.rb +68 -36
- data/lib/ruote-kit/resources/schedules.rb +27 -0
- data/lib/ruote-kit/resources/workitems.rb +93 -31
- data/lib/ruote-kit/spec/ruote_helpers.rb +25 -16
- data/lib/ruote-kit/version.rb +3 -1
- data/lib/ruote-kit/views/_pagination.html.haml +38 -0
- data/lib/ruote-kit/views/_tree_editor.html.haml +52 -0
- data/lib/ruote-kit/views/error.html.haml +69 -0
- data/lib/ruote-kit/views/errors.html.haml +28 -12
- data/lib/ruote-kit/views/expression.html.haml +161 -30
- data/lib/ruote-kit/views/expressions.html.haml +26 -21
- data/lib/ruote-kit/views/http_error.html.haml +11 -0
- data/lib/ruote-kit/views/index.html.haml +4 -0
- data/lib/ruote-kit/views/layout.html.haml +52 -32
- data/lib/ruote-kit/views/participants.html.haml +79 -0
- data/lib/ruote-kit/views/process.html.haml +109 -42
- data/lib/ruote-kit/views/process_launched.html.haml +6 -2
- data/lib/ruote-kit/views/processes.html.haml +55 -24
- data/lib/ruote-kit/views/processes_new.html.haml +36 -0
- data/lib/ruote-kit/views/schedules.html.haml +42 -0
- data/lib/ruote-kit/views/workitem.html.haml +83 -29
- data/lib/ruote-kit/views/workitems.html.haml +42 -19
- data/lib/ruote-kit.rb +17 -88
- data/ruote-kit.gemspec +68 -80
- data/spec/it_has_an_engine.rb +69 -0
- data/spec/resources/errors_spec.rb +198 -270
- data/spec/resources/expressions_spec.rb +308 -52
- data/spec/resources/index_spec.rb +28 -16
- data/spec/resources/participants_spec.rb +102 -0
- data/spec/resources/processes_spec.rb +218 -104
- data/spec/resources/schedules_spec.rb +97 -0
- data/spec/resources/workitems_spec.rb +195 -100
- data/spec/ruote-kit_configure_spec.rb +32 -75
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +31 -92
- data/spec/webapp_helpers_spec.rb +309 -0
- metadata +87 -152
- data/lib/ruote-kit/configuration.rb +0 -83
- data/lib/ruote-kit/helpers/engine_helpers.rb +0 -24
- data/lib/ruote-kit/helpers/form_helpers.rb +0 -11
- data/lib/ruote-kit/helpers/launch_item_parser.rb +0 -59
- data/lib/ruote-kit/helpers/navigation_helpers.rb +0 -54
- data/lib/ruote-kit/helpers.rb +0 -9
- data/lib/ruote-kit/public/_ruote/images/bg.gif +0 -0
- data/lib/ruote-kit/public/_ruote/images/bg_button_left.gif +0 -0
- data/lib/ruote-kit/public/_ruote/images/bg_button_left_cancel.gif +0 -0
- data/lib/ruote-kit/public/_ruote/images/bg_button_left_submit.gif +0 -0
- data/lib/ruote-kit/public/_ruote/images/bg_button_right.gif +0 -0
- data/lib/ruote-kit/public/_ruote/javascripts/SimplyButtons.js +0 -191
- data/lib/ruote-kit/public/_ruote/javascripts/fluo-dial.js +0 -149
- data/lib/ruote-kit/public/_ruote/stylesheets/SimplyButtons.css +0 -226
- data/lib/ruote-kit/public/_ruote/stylesheets/base.css +0 -336
- data/lib/ruote-kit/public/_ruote/stylesheets/style.css +0 -393
- data/lib/ruote-kit/views/launch_process.html.haml +0 -19
- data/lib/ruote-kit/views/process_failed_to_launch.html.haml +0 -7
- data/lib/ruote-kit/views/resource_not_found.html.haml +0 -7
- data/spec/helpers/render_helpers_spec.rb +0 -214
- data/spec/ruote-kit_spec.rb +0 -4
- data/spec/views/expressions.html.haml_spec.rb +0 -31
- data/spec/views/launch_process.html.haml_spec.rb +0 -22
- data/spec/views/process.html.haml_spec.rb +0 -17
- data/spec/views/process_launched.html.haml_spec.rb +0 -16
- data/spec/views/processes.html.haml_spec.rb +0 -31
- data/spec/views/workitems.html.haml_spec.rb +0 -69
@@ -1,19 +1,36 @@
|
|
1
|
-
|
1
|
+
|
2
|
+
require 'spec_helper'
|
2
3
|
|
3
4
|
undef :context if defined?(context)
|
4
5
|
|
5
|
-
describe "GET /_ruote/workitems", :type => :with_engine do
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
def workitem_count(from, to, of)
|
8
|
+
[
|
9
|
+
from, 'to', to, 'of', of, 'workitems'
|
10
|
+
].collect { |e|
|
11
|
+
e.to_s
|
12
|
+
}.join("\n ")
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
describe 'GET /_ruote/workitems' do
|
17
|
+
|
18
|
+
it_has_an_engine
|
19
|
+
|
20
|
+
describe 'without any workitems' do
|
21
|
+
|
22
|
+
it 'should report no workitems (HTML)' do
|
23
|
+
|
24
|
+
get '/_ruote/workitems'
|
10
25
|
|
11
26
|
last_response.should be_ok
|
12
|
-
|
27
|
+
|
28
|
+
last_response.should match(workitem_count(0, 0, 0))
|
13
29
|
end
|
14
30
|
|
15
|
-
it
|
16
|
-
|
31
|
+
it 'should report no workitems (JSON)' do
|
32
|
+
|
33
|
+
get '/_ruote/workitems.json'
|
17
34
|
|
18
35
|
last_response.should be_ok
|
19
36
|
json = last_response.json_body
|
@@ -23,8 +40,10 @@ describe "GET /_ruote/workitems", :type => :with_engine do
|
|
23
40
|
end
|
24
41
|
end
|
25
42
|
|
26
|
-
describe
|
43
|
+
describe 'with workitems' do
|
44
|
+
|
27
45
|
before(:each) do
|
46
|
+
|
28
47
|
@wfid = launch_test_process do
|
29
48
|
Ruote.process_definition :name => 'test' do
|
30
49
|
sequence do
|
@@ -34,15 +53,16 @@ describe "GET /_ruote/workitems", :type => :with_engine do
|
|
34
53
|
end
|
35
54
|
end
|
36
55
|
|
37
|
-
it
|
38
|
-
get "/_ruote/workitems"
|
56
|
+
it 'should have a list of workitems (HTML)' do
|
39
57
|
|
40
|
-
|
41
|
-
|
58
|
+
get '/_ruote/workitems'
|
59
|
+
|
60
|
+
last_response.should match(workitem_count(1, 1, 1))
|
42
61
|
end
|
43
62
|
|
44
|
-
it
|
45
|
-
|
63
|
+
it 'should have a list of workitems (JSON)' do
|
64
|
+
|
65
|
+
get '/_ruote/workitems.json'
|
46
66
|
|
47
67
|
last_response.should be_ok
|
48
68
|
json = last_response.json_body
|
@@ -52,16 +72,19 @@ describe "GET /_ruote/workitems", :type => :with_engine do
|
|
52
72
|
wi = json['workitems'][0]
|
53
73
|
|
54
74
|
wi.keys.should include('fei', 'participant_name', 'fields')
|
55
|
-
wi['
|
75
|
+
wi['wfid'].should == @wfid
|
56
76
|
wi['participant_name'].should == 'nada'
|
57
77
|
wi['fields']['params']['activity'].should == 'Work your magic'
|
58
78
|
end
|
59
79
|
end
|
60
80
|
end
|
61
81
|
|
62
|
-
describe
|
82
|
+
describe 'GET /_ruote/workitems/wfid' do
|
83
|
+
|
84
|
+
it_has_an_engine
|
85
|
+
|
86
|
+
describe 'with workitems' do
|
63
87
|
|
64
|
-
describe "with workitems" do
|
65
88
|
before(:each) do
|
66
89
|
@wfid = launch_test_process do
|
67
90
|
Ruote.process_definition :name => 'foo' do
|
@@ -73,14 +96,18 @@ describe "GET /_ruote/workitems/wfid", :type => :with_engine do
|
|
73
96
|
end
|
74
97
|
end
|
75
98
|
|
76
|
-
it
|
99
|
+
it 'should list the workitems (HTML)' do
|
100
|
+
|
77
101
|
get "/_ruote/workitems/#{@wfid}"
|
78
102
|
|
79
103
|
last_response.should be_ok
|
80
|
-
|
104
|
+
|
105
|
+
last_response.should have_selector(
|
106
|
+
'div#pagination', :content => '2 workitems')
|
81
107
|
end
|
82
108
|
|
83
|
-
it
|
109
|
+
it 'should list the workitems (JSON)' do
|
110
|
+
|
84
111
|
get "/_ruote/workitems/#{@wfid}.json"
|
85
112
|
|
86
113
|
last_response.should be_ok
|
@@ -92,16 +119,21 @@ describe "GET /_ruote/workitems/wfid", :type => :with_engine do
|
|
92
119
|
end
|
93
120
|
end
|
94
121
|
|
95
|
-
describe
|
96
|
-
|
97
|
-
|
122
|
+
describe 'without workitems' do
|
123
|
+
|
124
|
+
it 'should report no workitems (HTML)' do
|
125
|
+
|
126
|
+
get '/_ruote/workitems/foo'
|
98
127
|
|
99
128
|
last_response.should be_ok
|
100
|
-
|
129
|
+
|
130
|
+
last_response.should have_selector(
|
131
|
+
'div#pagination', :content => '0 workitems')
|
101
132
|
end
|
102
133
|
|
103
|
-
it
|
104
|
-
|
134
|
+
it 'should report an empty list (JSON)' do
|
135
|
+
|
136
|
+
get '/_ruote/workitems/foo.json'
|
105
137
|
|
106
138
|
last_response.should be_ok
|
107
139
|
|
@@ -113,9 +145,12 @@ describe "GET /_ruote/workitems/wfid", :type => :with_engine do
|
|
113
145
|
end
|
114
146
|
end
|
115
147
|
|
116
|
-
describe
|
148
|
+
describe 'GET /_ruote/workitems/expid!!wfid' do
|
149
|
+
|
150
|
+
it_has_an_engine
|
151
|
+
|
152
|
+
describe 'with a workitem' do
|
117
153
|
|
118
|
-
describe "with a workitem" do
|
119
154
|
before(:each) do
|
120
155
|
@wfid = launch_test_process do
|
121
156
|
Ruote.process_definition :name => 'foo' do
|
@@ -125,35 +160,56 @@ describe "GET /_ruote/workitems/wfid/expid", :type => :with_engine do
|
|
125
160
|
end
|
126
161
|
end
|
127
162
|
|
128
|
-
process = engine.process(
|
129
|
-
@nada_exp_id =
|
163
|
+
process = engine.process(@wfid)
|
164
|
+
@nada_exp_id = '0_0_0' #process.expressions.last.fei.expid
|
130
165
|
|
131
166
|
@nada_exp_id.should_not be_nil
|
132
167
|
end
|
133
168
|
|
134
|
-
it
|
135
|
-
|
169
|
+
it 'should return it (HTML)' do
|
170
|
+
|
171
|
+
get "/_ruote/workitems/#{@nada_exp_id}!!#{@wfid}"
|
136
172
|
|
137
173
|
last_response.should be_ok
|
138
174
|
end
|
139
175
|
|
140
|
-
it
|
141
|
-
|
176
|
+
it 'should return it (JSON)' do
|
177
|
+
|
178
|
+
get "/_ruote/workitems/#{@nada_exp_id}!!#{@wfid}.json"
|
142
179
|
|
143
180
|
last_response.should be_ok
|
144
181
|
end
|
182
|
+
|
183
|
+
it 'should provide a workitem with the correct links (JSON)' do
|
184
|
+
|
185
|
+
get "/_ruote/workitems/#{@nada_exp_id}!!#{@wfid}.json"
|
186
|
+
|
187
|
+
json = last_response.json_body
|
188
|
+
|
189
|
+
assert_equal(
|
190
|
+
%w[
|
191
|
+
self
|
192
|
+
http://ruote.rubyforge.org/rels.html#process
|
193
|
+
http://ruote.rubyforge.org/rels.html#process_expressions
|
194
|
+
http://ruote.rubyforge.org/rels.html#process_errors
|
195
|
+
],
|
196
|
+
json['workitem']['links'].collect { |li| li['rel'] })
|
197
|
+
end
|
145
198
|
end
|
146
199
|
|
147
|
-
describe
|
148
|
-
|
149
|
-
|
200
|
+
describe 'without a workitem' do
|
201
|
+
|
202
|
+
it 'should return a 404 (HTML)' do
|
203
|
+
|
204
|
+
get '/_ruote/workitems/foo/bar'
|
150
205
|
|
151
206
|
last_response.should_not be_ok
|
152
207
|
last_response.status.should be(404)
|
153
208
|
end
|
154
209
|
|
155
|
-
it
|
156
|
-
|
210
|
+
it 'should return a 404 (JSON)' do
|
211
|
+
|
212
|
+
get '/_ruote/workitems/foo/bar.json'
|
157
213
|
|
158
214
|
last_response.should_not be_ok
|
159
215
|
last_response.status.should be(404)
|
@@ -161,75 +217,89 @@ describe "GET /_ruote/workitems/wfid/expid", :type => :with_engine do
|
|
161
217
|
end
|
162
218
|
end
|
163
219
|
|
164
|
-
describe
|
220
|
+
describe 'PUT /_ruote/workitems/fei' do
|
221
|
+
|
222
|
+
it_has_an_engine
|
165
223
|
|
166
224
|
before(:each) do
|
225
|
+
|
167
226
|
@wfid = launch_test_process do
|
168
227
|
Ruote.process_definition :name => 'foo' do
|
169
228
|
sequence do
|
170
229
|
nada :activity => 'Work your magic'
|
171
|
-
echo
|
230
|
+
echo '${f:foo}'
|
172
231
|
end
|
173
232
|
end
|
174
233
|
end
|
175
234
|
|
176
|
-
process = engine.process(
|
177
|
-
@nada_exp_id =
|
235
|
+
process = engine.process(@wfid)
|
236
|
+
@nada_exp_id = '0_0_0' #process.expressions.last.fei.expid
|
178
237
|
|
179
238
|
@nada_exp_id.should_not be_nil
|
180
|
-
end
|
181
239
|
|
182
|
-
|
183
|
-
|
184
|
-
"params" => {
|
185
|
-
"activity" => "Work your magic",
|
186
|
-
},
|
187
|
-
"foo" => "bar"
|
240
|
+
@fields = {
|
241
|
+
'params' => { 'activity' => 'Work your magic' }, 'foo' => 'bar'
|
188
242
|
}
|
243
|
+
end
|
244
|
+
|
245
|
+
it 'should update the workitem fields (HTML)' do
|
189
246
|
|
190
|
-
put
|
247
|
+
put(
|
248
|
+
"/_ruote/workitems/#{@nada_exp_id}!!#{@wfid}",
|
249
|
+
:fields => Rufus::Json.encode(@fields))
|
191
250
|
|
192
251
|
last_response.should be_redirect
|
193
|
-
last_response['Location'].should == "/_ruote/workitems/#{@wfid}/#{@nada_exp_id}"
|
194
252
|
|
195
|
-
|
253
|
+
last_response['Location'].should ==
|
254
|
+
"/_ruote/workitems/#{@nada_exp_id}!!#{@wfid}"
|
255
|
+
|
256
|
+
find_workitem(@wfid, @nada_exp_id).fields.should == @fields
|
196
257
|
|
197
258
|
sleep 0.4
|
198
259
|
|
199
|
-
@tracer.to_s.should ==
|
260
|
+
@tracer.to_s.should == ''
|
200
261
|
end
|
201
262
|
|
202
|
-
it
|
203
|
-
|
204
|
-
|
205
|
-
"activity" => "Work your magic",
|
206
|
-
},
|
207
|
-
"foo" => "bar"
|
208
|
-
}
|
209
|
-
params = {
|
210
|
-
"fields" => fields
|
211
|
-
}
|
263
|
+
it 'should update the workitem fields (JSON)' do
|
264
|
+
|
265
|
+
params = { 'fields' => @fields }
|
212
266
|
|
213
|
-
put
|
267
|
+
put(
|
268
|
+
"/_ruote/workitems/#{@nada_exp_id}!!#{@wfid}.json",
|
269
|
+
Rufus::Json.encode(params),
|
270
|
+
{ 'CONTENT_TYPE' => 'application/json' })
|
214
271
|
|
215
272
|
last_response.should be_ok
|
216
273
|
|
217
|
-
find_workitem(
|
274
|
+
find_workitem(@wfid, @nada_exp_id).fields.should == @fields
|
218
275
|
|
219
276
|
sleep 0.4
|
220
277
|
|
221
|
-
@tracer.to_s.should ==
|
278
|
+
@tracer.to_s.should == ''
|
279
|
+
end
|
280
|
+
|
281
|
+
it 'should update the fields when passed {"workitem":...} (JSON)' do
|
282
|
+
|
283
|
+
params = { 'workitem' => { 'fields' => @fields } }
|
284
|
+
|
285
|
+
put(
|
286
|
+
"/_ruote/workitems/#{@nada_exp_id}!!#{@wfid}.json",
|
287
|
+
Rufus::Json.encode(params),
|
288
|
+
{ 'CONTENT_TYPE' => 'application/json' })
|
289
|
+
|
290
|
+
last_response.should be_ok
|
291
|
+
|
292
|
+
find_workitem(@wfid, @nada_exp_id).fields.should == @fields
|
222
293
|
end
|
223
294
|
|
224
|
-
it
|
225
|
-
|
226
|
-
|
227
|
-
"activity" => "Work your magic",
|
228
|
-
},
|
229
|
-
"foo" => "bar"
|
230
|
-
})
|
295
|
+
it 'should reply to the engine (HTML)' do
|
296
|
+
|
297
|
+
fields = Rufus::Json.encode(@fields)
|
231
298
|
|
232
|
-
put
|
299
|
+
put(
|
300
|
+
"/_ruote/workitems/#{@nada_exp_id}!!#{@wfid}",
|
301
|
+
:fields => fields,
|
302
|
+
:_proceed => '1')
|
233
303
|
|
234
304
|
last_response.should be_redirect
|
235
305
|
last_response['Location'].should == "/_ruote/workitems/#{@wfid}"
|
@@ -240,22 +310,17 @@ describe "PUT /_ruote/workitems/X-Y", :type => :with_engine do
|
|
240
310
|
#])
|
241
311
|
sleep 0.5
|
242
312
|
|
243
|
-
@tracer.to_s.should ==
|
313
|
+
@tracer.to_s.should == 'bar'
|
244
314
|
end
|
245
315
|
|
246
|
-
it
|
247
|
-
|
248
|
-
|
249
|
-
"activity" => "Work your magic",
|
250
|
-
},
|
251
|
-
"foo" => "bar"
|
252
|
-
}
|
253
|
-
params = {
|
254
|
-
"fields" => fields,
|
255
|
-
"_proceed" => "1"
|
256
|
-
}
|
316
|
+
it 'should reply to the engine (JSON)' do
|
317
|
+
|
318
|
+
params = { 'fields' => @fields, '_proceed' => '1' }
|
257
319
|
|
258
|
-
put
|
320
|
+
put(
|
321
|
+
"/_ruote/workitems/#{@nada_exp_id}!!#{@wfid}.json",
|
322
|
+
Rufus::Json.encode(params),
|
323
|
+
{ 'CONTENT_TYPE' => 'application/json' })
|
259
324
|
|
260
325
|
last_response.should be_ok
|
261
326
|
|
@@ -265,13 +330,33 @@ describe "PUT /_ruote/workitems/X-Y", :type => :with_engine do
|
|
265
330
|
#])
|
266
331
|
sleep 0.5
|
267
332
|
|
268
|
-
@tracer.to_s.should ==
|
333
|
+
@tracer.to_s.should == 'bar'
|
334
|
+
end
|
335
|
+
|
336
|
+
it 'should 400 when passed bogus JSON fields (HTML)' do
|
337
|
+
|
338
|
+
put "/_ruote/workitems/#{@nada_exp_id}!!#{@wfid}", :fields => '{"bogus"}'
|
339
|
+
|
340
|
+
last_response.status.should be(400)
|
341
|
+
end
|
342
|
+
|
343
|
+
it 'should 400 when passed bogus JSON fields (JSON)' do
|
344
|
+
|
345
|
+
put(
|
346
|
+
"/_ruote/workitems/#{@nada_exp_id}!!#{@wfid}.json",
|
347
|
+
"{'bogus'}",
|
348
|
+
{ 'CONTENT_TYPE' => 'application/json' })
|
349
|
+
|
350
|
+
last_response.status.should be(400)
|
269
351
|
end
|
270
352
|
end
|
271
353
|
|
272
|
-
describe
|
354
|
+
describe 'Filtering workitems' do
|
355
|
+
|
356
|
+
it_has_an_engine
|
273
357
|
|
274
358
|
before(:each) do
|
359
|
+
|
275
360
|
@wfid = launch_test_process do
|
276
361
|
Ruote.process_definition :name => 'test' do
|
277
362
|
set 'foo' => 'bar'
|
@@ -291,9 +376,10 @@ describe "Filtering workitems", :type => :with_engine do
|
|
291
376
|
end
|
292
377
|
end
|
293
378
|
|
294
|
-
describe
|
379
|
+
describe 'on participants' do
|
380
|
+
|
381
|
+
it 'should narrow results down to a single participant (JSON)' do
|
295
382
|
|
296
|
-
it "should narrow results down to a single participant (JSON)" do
|
297
383
|
get '/_ruote/workitems.json', :participant => 'jack'
|
298
384
|
|
299
385
|
last_response.should be_ok
|
@@ -301,17 +387,21 @@ describe "Filtering workitems", :type => :with_engine do
|
|
301
387
|
last_response.json_body['workitems'].size.should be(1)
|
302
388
|
end
|
303
389
|
|
304
|
-
it
|
390
|
+
it 'should narrow results down to a single participant (HTML)' do
|
391
|
+
|
305
392
|
get '/_ruote/workitems', :participant => 'jack'
|
306
393
|
|
307
394
|
last_response.should be_ok
|
395
|
+
|
396
|
+
last_response.should match(workitem_count(1, 3, 3))
|
308
397
|
end
|
309
398
|
|
310
399
|
end
|
311
400
|
|
312
|
-
describe
|
401
|
+
describe 'on field values' do
|
402
|
+
|
403
|
+
it 'should find workitems with fields set to a given value (JSON)' do
|
313
404
|
|
314
|
-
it "should find worktitems with fields set to a given value (JSON)" do
|
315
405
|
get '/_ruote/workitems.json', :hinkypinky => 'honkytonky'
|
316
406
|
|
317
407
|
last_response.should be_ok
|
@@ -319,13 +409,15 @@ describe "Filtering workitems", :type => :with_engine do
|
|
319
409
|
last_response.json_body['workitems'].size.should be(2)
|
320
410
|
end
|
321
411
|
|
322
|
-
it
|
412
|
+
it 'should find workitems with fields set to a given value (HTML)' do
|
413
|
+
|
323
414
|
get '/_ruote/workitems', :hinkypinky => 'honkytonky'
|
324
415
|
|
325
416
|
last_response.should be_ok
|
326
417
|
end
|
327
418
|
|
328
|
-
it
|
419
|
+
it 'should respect JSON encoded filter vars (JSON)' do
|
420
|
+
|
329
421
|
get '/_ruote/workitems.json', :wands => 101
|
330
422
|
|
331
423
|
last_response.should be_ok
|
@@ -333,13 +425,15 @@ describe "Filtering workitems", :type => :with_engine do
|
|
333
425
|
last_response.json_body['workitems'].size.should be(1)
|
334
426
|
end
|
335
427
|
|
336
|
-
it
|
428
|
+
it 'should respect JSON encoded filter vars (HTML)' do
|
429
|
+
|
337
430
|
get '/_ruote/workitems', :wands => 101
|
338
431
|
|
339
432
|
last_response.should be_ok
|
340
433
|
end
|
341
434
|
|
342
435
|
it "should combine search criteria by 'and' (JSON)" do
|
436
|
+
|
343
437
|
get '/_ruote/workitems.json', :hinkypinky => 'honkytonky', :wands => 101
|
344
438
|
|
345
439
|
last_response.should be_ok
|
@@ -348,10 +442,11 @@ describe "Filtering workitems", :type => :with_engine do
|
|
348
442
|
end
|
349
443
|
|
350
444
|
it "should combine search criteria by 'and' (HMTL)" do
|
445
|
+
|
351
446
|
get '/_ruote/workitems', :hinkypinky => 'honkytonky', :wands => 101
|
352
447
|
|
353
448
|
last_response.should be_ok
|
354
449
|
end
|
355
|
-
|
356
450
|
end
|
357
451
|
end
|
452
|
+
|
@@ -3,97 +3,54 @@ require File.join(File.dirname(__FILE__), 'spec_helper.rb')
|
|
3
3
|
|
4
4
|
undef :context if defined?(context)
|
5
5
|
|
6
|
-
class MyCustomStorage
|
7
|
-
attr_reader :opts
|
8
|
-
def initialize (opts)
|
9
|
-
@opts = opts
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class MyParticipant
|
14
|
-
end
|
15
6
|
|
16
7
|
describe RuoteKit do
|
17
8
|
|
18
|
-
describe '
|
9
|
+
# describe 'run_worker' do
|
10
|
+
#
|
11
|
+
# before(:each) do
|
12
|
+
# RuoteKit.run_worker(Ruote::HashStorage.new)
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# it 'should instantiate an engine' do
|
16
|
+
# RuoteKit.engine.should_not == nil
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# it 'should instantiate an engine with a worker' do
|
20
|
+
# RuoteKit.engine.worker.should_not == nil
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# it 'should instantiate an engine bound to a storage' do
|
24
|
+
# RuoteKit.engine.storage.class.should == Ruote::HashStorage
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
|
28
|
+
describe 'bind_engine' do
|
19
29
|
|
20
30
|
before(:each) do
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should default to :transient' do
|
25
|
-
|
26
|
-
RuoteKit.configuration.mode.should == :transient
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe 'configure with a custom storage' do
|
31
|
-
|
32
|
-
before(:each) do
|
33
|
-
|
34
|
-
RuoteKit.configure do |conf|
|
35
|
-
#require 'path/to/my_custom_storage'
|
36
|
-
conf.set_storage( MyCustomStorage, :a => 'A', :b => 'B' )
|
37
|
-
conf.run_engine = false
|
38
|
-
end
|
31
|
+
RuoteKit.bind_engine(Ruote::HashStorage.new)
|
39
32
|
end
|
40
33
|
|
41
|
-
|
42
|
-
RuoteKit.
|
34
|
+
it 'should instantiate an engine' do
|
35
|
+
RuoteKit.engine.should_not == nil
|
43
36
|
end
|
44
37
|
|
45
|
-
it 'should
|
46
|
-
|
47
|
-
RuoteKit.configuration.mode.should == :custom
|
38
|
+
it 'should instantiate an engine without a worker' do
|
39
|
+
RuoteKit.engine.worker.should == nil
|
48
40
|
end
|
49
41
|
|
50
|
-
it 'should
|
51
|
-
|
52
|
-
si = RuoteKit.configuration.storage_instance
|
53
|
-
|
54
|
-
si.class.should == MyCustomStorage
|
55
|
-
si.opts.should == { :a => 'A', :b => 'B' }
|
42
|
+
it 'should instantiate an engine bound to a storage' do
|
43
|
+
RuoteKit.engine.storage.class.should == Ruote::HashStorage
|
56
44
|
end
|
57
45
|
end
|
58
46
|
|
59
|
-
describe '
|
60
|
-
|
61
|
-
require 'ruote/participant'
|
62
|
-
|
63
|
-
describe 'custom participant' do
|
64
|
-
RuoteKit.configure do |conf|
|
65
|
-
conf.register do
|
66
|
-
participant 'al', MyParticipant
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
RuoteKit.engine.context.plist.names.should == ['^al$']
|
71
|
-
end
|
47
|
+
describe 'direct engine setting' do
|
72
48
|
|
73
|
-
|
74
|
-
RuoteKit.configure do |conf|
|
75
|
-
conf.register do
|
76
|
-
catchall MyParticipant
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
RuoteKit.engine.context.plist.names.should == [ '^.+$' ]
|
81
|
-
end
|
82
|
-
|
83
|
-
describe 'catchall participant without any options' do
|
84
|
-
require 'ruote/part/storage_participant'
|
85
|
-
|
86
|
-
RuoteKit.configure do |conf|
|
87
|
-
conf.register do
|
88
|
-
catchall
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
RuoteKit.engine.context.plist.lookup('.+').instance_of?(Ruote::StorageParticipant).should == true
|
93
|
-
end
|
49
|
+
# stupid illustrative spec
|
94
50
|
|
95
|
-
|
96
|
-
RuoteKit.
|
51
|
+
it 'should comply' do
|
52
|
+
RuoteKit.engine = Ruote::Engine.new(Ruote::HashStorage.new)
|
53
|
+
RuoteKit.engine.should_not == nil
|
97
54
|
end
|
98
55
|
end
|
99
56
|
end
|
data/spec/spec.opts
CHANGED