ruote-kit 2.1.8.2 → 2.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +20 -4
- data/README.rdoc +62 -13
- data/Rakefile +9 -12
- data/config.ru +22 -5
- data/lib/ruote-kit.rb +2 -3
- data/lib/ruote-kit/application.rb +1 -1
- data/lib/ruote-kit/helpers/launch_item_parser.rb +5 -5
- data/lib/ruote-kit/helpers/render_helpers.rb +42 -25
- data/lib/ruote-kit/resources/errors.rb +65 -0
- data/lib/ruote-kit/resources/expressions.rb +1 -1
- data/lib/ruote-kit/resources/processes.rb +2 -1
- data/lib/ruote-kit/resources/workitems.rb +8 -9
- data/lib/ruote-kit/spec/ruote_helpers.rb +1 -1
- data/lib/ruote-kit/version.rb +1 -1
- data/lib/ruote-kit/views/errors.html.haml +18 -0
- data/lib/ruote-kit/views/workitem.html.haml +3 -3
- data/ruote-kit.gemspec +24 -11
- data/spec/resources/errors_spec.rb +292 -0
- data/spec/resources/processes_spec.rb +4 -3
- data/spec/resources/workitems_spec.rb +55 -13
- data/spec/spec_helper.rb +6 -7
- metadata +91 -18
@@ -79,6 +79,7 @@ describe "GET /_ruote/processes/X-Y", :type => :with_engine do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
it "should 404 correctly (JSON)" do
|
82
|
+
|
82
83
|
get "/_ruote/processes/foo.json"
|
83
84
|
|
84
85
|
last_response.should_not be_ok
|
@@ -112,7 +113,7 @@ describe "POST /_ruote/processes", :type => :with_engine do
|
|
112
113
|
end}
|
113
114
|
}
|
114
115
|
|
115
|
-
post '/_ruote/processes.json', params
|
116
|
+
post '/_ruote/processes.json', Rufus::Json.encode(params), { 'CONTENT_TYPE' => 'application/json' }
|
116
117
|
|
117
118
|
last_response.should be_ok
|
118
119
|
|
@@ -131,7 +132,7 @@ describe "POST /_ruote/processes", :type => :with_engine do
|
|
131
132
|
:fields => { :foo => 'bar' }
|
132
133
|
}
|
133
134
|
|
134
|
-
post '/_ruote/processes.json', params
|
135
|
+
post '/_ruote/processes.json', Rufus::Json.encode(params), { 'CONTENT_TYPE' => 'application/json' }
|
135
136
|
|
136
137
|
last_response.should be_ok
|
137
138
|
last_response.json_body['launched'].should match(/[0-9a-z\-]+/)
|
@@ -195,7 +196,7 @@ describe "POST /_ruote/processes", :type => :with_engine do
|
|
195
196
|
it "should return a 422 unprocessable entity error when launching a process fails (JSON)" do
|
196
197
|
params = { :definition => 'http://invalid.invalid' }
|
197
198
|
|
198
|
-
post '/_ruote/processes.json', params
|
199
|
+
post '/_ruote/processes.json', Rufus::Json.encode(params), { 'CONTENT_TYPE' => 'application/json' }
|
199
200
|
|
200
201
|
last_response.should_not be_ok
|
201
202
|
last_response.status.should be(422)
|
@@ -210,7 +210,7 @@ describe "PUT /_ruote/workitems/X-Y", :type => :with_engine do
|
|
210
210
|
"fields" => fields
|
211
211
|
}
|
212
212
|
|
213
|
-
put "/_ruote/workitems/#{@wfid}/#{@nada_exp_id}.json", params
|
213
|
+
put "/_ruote/workitems/#{@wfid}/#{@nada_exp_id}.json", Rufus::Json.encode(params), { 'CONTENT_TYPE' => 'application/json' }
|
214
214
|
|
215
215
|
last_response.should be_ok
|
216
216
|
|
@@ -222,12 +222,12 @@ describe "PUT /_ruote/workitems/X-Y", :type => :with_engine do
|
|
222
222
|
end
|
223
223
|
|
224
224
|
it "should reply to the engine (HTML)" do
|
225
|
-
fields = {
|
225
|
+
fields = Rufus::Json.encode({
|
226
226
|
"params" => {
|
227
227
|
"activity" => "Work your magic",
|
228
228
|
},
|
229
229
|
"foo" => "bar"
|
230
|
-
}
|
230
|
+
})
|
231
231
|
|
232
232
|
put "/_ruote/workitems/#{@wfid}/#{@nada_exp_id}", :fields => fields, :_proceed => '1'
|
233
233
|
|
@@ -271,18 +271,27 @@ end
|
|
271
271
|
|
272
272
|
describe "Filtering workitems", :type => :with_engine do
|
273
273
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
274
|
+
before(:each) do
|
275
|
+
@wfid = launch_test_process do
|
276
|
+
Ruote.process_definition :name => 'test' do
|
277
|
+
set 'foo' => 'bar'
|
278
|
+
concurrence do
|
279
|
+
sequence do
|
280
|
+
set 'wands' => 101
|
281
|
+
set 'hinkypinky' => 'honkytonky'
|
279
282
|
jack :activity => 'Fetch a pale'
|
283
|
+
end
|
284
|
+
sequence do
|
285
|
+
set 'hinkypinky' => 'honkytonky'
|
280
286
|
jill :activity => 'Chase Jack'
|
281
|
-
well :activity => 'Ready water'
|
282
287
|
end
|
288
|
+
well :activity => 'Ready water'
|
283
289
|
end
|
284
290
|
end
|
285
291
|
end
|
292
|
+
end
|
293
|
+
|
294
|
+
describe "on participants" do
|
286
295
|
|
287
296
|
it "should narrow results down to a single participant (JSON)" do
|
288
297
|
get '/_ruote/workitems.json', :participant => 'jack'
|
@@ -298,18 +307,51 @@ describe "Filtering workitems", :type => :with_engine do
|
|
298
307
|
last_response.should be_ok
|
299
308
|
end
|
300
309
|
|
301
|
-
|
302
|
-
|
310
|
+
end
|
311
|
+
|
312
|
+
describe "on field values" do
|
313
|
+
|
314
|
+
it "should find worktitems with fields set to a given value (JSON)" do
|
315
|
+
get '/_ruote/workitems.json', :hinkypinky => 'honkytonky'
|
303
316
|
|
304
317
|
last_response.should be_ok
|
305
318
|
|
306
319
|
last_response.json_body['workitems'].size.should be(2)
|
307
320
|
end
|
308
321
|
|
309
|
-
it "should
|
310
|
-
get
|
322
|
+
it "should find worktitems with fields set to a given value (HTML)" do
|
323
|
+
get '/_ruote/workitems', :hinkypinky => 'honkytonky'
|
311
324
|
|
312
325
|
last_response.should be_ok
|
313
326
|
end
|
327
|
+
|
328
|
+
it "should respect JSON encoded filter vars (JSON)" do
|
329
|
+
get '/_ruote/workitems.json', :wands => 101
|
330
|
+
|
331
|
+
last_response.should be_ok
|
332
|
+
|
333
|
+
last_response.json_body['workitems'].size.should be(1)
|
334
|
+
end
|
335
|
+
|
336
|
+
it "should respect JSON encoded filter vars (HTML)" do
|
337
|
+
get '/_ruote/workitems', :wands => 101
|
338
|
+
|
339
|
+
last_response.should be_ok
|
340
|
+
end
|
341
|
+
|
342
|
+
it "should combine search criteria by 'and' (JSON)" do
|
343
|
+
get '/_ruote/workitems.json', :hinkypinky => 'honkytonky', :wands => 101
|
344
|
+
|
345
|
+
last_response.should be_ok
|
346
|
+
|
347
|
+
last_response.json_body['workitems'].size.should be(1)
|
348
|
+
end
|
349
|
+
|
350
|
+
it "should combine search criteria by 'and' (HMTL)" do
|
351
|
+
get '/_ruote/workitems', :hinkypinky => 'honkytonky', :wands => 101
|
352
|
+
|
353
|
+
last_response.should be_ok
|
354
|
+
end
|
355
|
+
|
314
356
|
end
|
315
357
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
ENV['RACK_ENV'] = 'test'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
require 'rubygems'
|
7
|
-
gem 'rspec'
|
8
|
-
require 'spec'
|
9
|
-
end
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
Bundler.setup(:default, :test)
|
10
6
|
|
7
|
+
require 'spec'
|
11
8
|
require 'spec/interop/test'
|
12
9
|
require 'rack/test'
|
13
10
|
|
14
11
|
require 'webrat'
|
15
12
|
|
13
|
+
require 'json'
|
14
|
+
|
16
15
|
Test::Unit::TestCase.send :include, Rack::Test::Methods
|
17
16
|
|
18
17
|
require File.dirname(__FILE__) + '/../vendor/gems/environment' if File.exists?( File.dirname(__FILE__) + '/../vendor/gems/environment.rb' )
|
metadata
CHANGED
@@ -1,141 +1,206 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruote-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 31
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 2
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 2.1.8.2
|
9
|
+
- 10
|
10
|
+
version: 2.1.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- kenneth.kalmer@gmail.com
|
14
|
+
- John Mettraux
|
14
15
|
autorequire:
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-
|
19
|
+
date: 2010-07-07 00:00:00 +02:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
name: bundler
|
23
|
-
prerelease: false
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
25
26
|
requirements:
|
26
27
|
- - ">="
|
27
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 49
|
28
30
|
segments:
|
29
31
|
- 0
|
30
32
|
- 9
|
31
33
|
- 5
|
32
34
|
version: 0.9.5
|
33
35
|
type: :runtime
|
36
|
+
prerelease: false
|
34
37
|
version_requirements: *id001
|
35
38
|
- !ruby/object:Gem::Dependency
|
36
39
|
name: sinatra
|
37
|
-
prerelease: false
|
38
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
39
42
|
requirements:
|
40
43
|
- - ">="
|
41
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 51
|
42
46
|
segments:
|
43
47
|
- 0
|
44
48
|
- 9
|
45
49
|
- 4
|
46
50
|
version: 0.9.4
|
47
51
|
type: :runtime
|
52
|
+
prerelease: false
|
48
53
|
version_requirements: *id002
|
49
54
|
- !ruby/object:Gem::Dependency
|
50
55
|
name: sinatra-respond_to
|
51
|
-
prerelease: false
|
52
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
53
58
|
requirements:
|
54
59
|
- - ">="
|
55
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 15
|
56
62
|
segments:
|
57
63
|
- 0
|
58
64
|
- 4
|
59
65
|
- 0
|
60
66
|
version: 0.4.0
|
61
67
|
type: :runtime
|
68
|
+
prerelease: false
|
62
69
|
version_requirements: *id003
|
63
70
|
- !ruby/object:Gem::Dependency
|
64
71
|
name: haml
|
65
|
-
prerelease: false
|
66
72
|
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
67
74
|
requirements:
|
68
75
|
- - ">="
|
69
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 13
|
70
78
|
segments:
|
71
79
|
- 2
|
72
80
|
- 2
|
73
81
|
- 5
|
74
82
|
version: 2.2.5
|
75
83
|
type: :runtime
|
84
|
+
prerelease: false
|
76
85
|
version_requirements: *id004
|
77
86
|
- !ruby/object:Gem::Dependency
|
78
|
-
name: json
|
79
|
-
prerelease: false
|
87
|
+
name: rufus-json
|
80
88
|
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
81
90
|
requirements:
|
82
91
|
- - ">="
|
83
92
|
- !ruby/object:Gem::Version
|
93
|
+
hash: 17
|
84
94
|
segments:
|
85
95
|
- 0
|
86
|
-
|
96
|
+
- 2
|
97
|
+
- 3
|
98
|
+
version: 0.2.3
|
87
99
|
type: :runtime
|
100
|
+
prerelease: false
|
88
101
|
version_requirements: *id005
|
89
102
|
- !ruby/object:Gem::Dependency
|
90
103
|
name: ruote
|
91
|
-
prerelease: false
|
92
104
|
requirement: &id006 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
93
106
|
requirements:
|
94
107
|
- - ">="
|
95
108
|
- !ruby/object:Gem::Version
|
109
|
+
hash: 31
|
96
110
|
segments:
|
97
111
|
- 2
|
98
112
|
- 1
|
99
|
-
-
|
100
|
-
version: 2.1.
|
113
|
+
- 10
|
114
|
+
version: 2.1.10
|
101
115
|
type: :runtime
|
116
|
+
prerelease: false
|
102
117
|
version_requirements: *id006
|
103
118
|
- !ruby/object:Gem::Dependency
|
104
119
|
name: rake
|
105
|
-
prerelease: false
|
106
120
|
requirement: &id007 !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
107
122
|
requirements:
|
108
123
|
- - ">="
|
109
124
|
- !ruby/object:Gem::Version
|
125
|
+
hash: 3
|
110
126
|
segments:
|
111
127
|
- 0
|
112
128
|
version: "0"
|
113
129
|
type: :development
|
130
|
+
prerelease: false
|
114
131
|
version_requirements: *id007
|
115
132
|
- !ruby/object:Gem::Dependency
|
116
133
|
name: rspec
|
117
|
-
prerelease: false
|
118
134
|
requirement: &id008 !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
119
136
|
requirements:
|
120
137
|
- - ">="
|
121
138
|
- !ruby/object:Gem::Version
|
139
|
+
hash: 3
|
122
140
|
segments:
|
123
141
|
- 0
|
124
142
|
version: "0"
|
125
143
|
type: :development
|
144
|
+
prerelease: false
|
126
145
|
version_requirements: *id008
|
127
146
|
- !ruby/object:Gem::Dependency
|
128
147
|
name: jeweler
|
129
|
-
prerelease: false
|
130
148
|
requirement: &id009 !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
131
150
|
requirements:
|
132
151
|
- - ">="
|
133
152
|
- !ruby/object:Gem::Version
|
153
|
+
hash: 3
|
134
154
|
segments:
|
135
155
|
- 0
|
136
156
|
version: "0"
|
137
157
|
type: :development
|
158
|
+
prerelease: false
|
138
159
|
version_requirements: *id009
|
160
|
+
- !ruby/object:Gem::Dependency
|
161
|
+
name: webrat
|
162
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
163
|
+
none: false
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
hash: 3
|
168
|
+
segments:
|
169
|
+
- 0
|
170
|
+
version: "0"
|
171
|
+
type: :development
|
172
|
+
prerelease: false
|
173
|
+
version_requirements: *id010
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: test-unit
|
176
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ~>
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
hash: 25
|
182
|
+
segments:
|
183
|
+
- 1
|
184
|
+
- 2
|
185
|
+
- 3
|
186
|
+
version: 1.2.3
|
187
|
+
type: :development
|
188
|
+
prerelease: false
|
189
|
+
version_requirements: *id011
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: rack-test
|
192
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ">="
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
hash: 3
|
198
|
+
segments:
|
199
|
+
- 0
|
200
|
+
version: "0"
|
201
|
+
type: :development
|
202
|
+
prerelease: false
|
203
|
+
version_requirements: *id012
|
139
204
|
description: ruote-kit is a RESTful Rack app for the ruote workflow engine
|
140
205
|
email: kenneth.kalmer@gmail.com
|
141
206
|
executables: []
|
@@ -172,11 +237,13 @@ files:
|
|
172
237
|
- lib/ruote-kit/public/_ruote/stylesheets/base.css
|
173
238
|
- lib/ruote-kit/public/_ruote/stylesheets/rk.css
|
174
239
|
- lib/ruote-kit/public/_ruote/stylesheets/style.css
|
240
|
+
- lib/ruote-kit/resources/errors.rb
|
175
241
|
- lib/ruote-kit/resources/expressions.rb
|
176
242
|
- lib/ruote-kit/resources/processes.rb
|
177
243
|
- lib/ruote-kit/resources/workitems.rb
|
178
244
|
- lib/ruote-kit/spec/ruote_helpers.rb
|
179
245
|
- lib/ruote-kit/version.rb
|
246
|
+
- lib/ruote-kit/views/errors.html.haml
|
180
247
|
- lib/ruote-kit/views/expression.html.haml
|
181
248
|
- lib/ruote-kit/views/expressions.html.haml
|
182
249
|
- lib/ruote-kit/views/index.html.haml
|
@@ -191,6 +258,7 @@ files:
|
|
191
258
|
- lib/ruote-kit/views/workitems.html.haml
|
192
259
|
- ruote-kit.gemspec
|
193
260
|
- spec/helpers/render_helpers_spec.rb
|
261
|
+
- spec/resources/errors_spec.rb
|
194
262
|
- spec/resources/expressions_spec.rb
|
195
263
|
- spec/resources/index_spec.rb
|
196
264
|
- spec/resources/processes_spec.rb
|
@@ -215,23 +283,27 @@ rdoc_options:
|
|
215
283
|
require_paths:
|
216
284
|
- lib
|
217
285
|
required_ruby_version: !ruby/object:Gem::Requirement
|
286
|
+
none: false
|
218
287
|
requirements:
|
219
288
|
- - ">="
|
220
289
|
- !ruby/object:Gem::Version
|
290
|
+
hash: 3
|
221
291
|
segments:
|
222
292
|
- 0
|
223
293
|
version: "0"
|
224
294
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
295
|
+
none: false
|
225
296
|
requirements:
|
226
297
|
- - ">="
|
227
298
|
- !ruby/object:Gem::Version
|
299
|
+
hash: 3
|
228
300
|
segments:
|
229
301
|
- 0
|
230
302
|
version: "0"
|
231
303
|
requirements: []
|
232
304
|
|
233
305
|
rubyforge_project:
|
234
|
-
rubygems_version: 1.3.
|
306
|
+
rubygems_version: 1.3.7
|
235
307
|
signing_key:
|
236
308
|
specification_version: 3
|
237
309
|
summary: ruote workflow engine, wrapped in a loving rack embrace
|
@@ -239,6 +311,7 @@ test_files:
|
|
239
311
|
- spec/resources/expressions_spec.rb
|
240
312
|
- spec/resources/workitems_spec.rb
|
241
313
|
- spec/resources/index_spec.rb
|
314
|
+
- spec/resources/errors_spec.rb
|
242
315
|
- spec/resources/processes_spec.rb
|
243
316
|
- spec/ruote-kit_configure_spec.rb
|
244
317
|
- spec/ruote-kit_spec.rb
|