forked from kennethkalmer/ruote-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
orphan_workitem_spec.rb
141 lines (85 loc) · 2.88 KB
/
orphan_workitem_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
require 'spec_helper'
describe RuoteKit do
context 'with an orphan workitem' do
before(:all) do
prepare_engine_with_participants
pdef = Ruote.process_definition :name => 'test' do
toto
end
#RuoteKit.engine.noisy = true
@wfid = RuoteKit.engine.launch(pdef)
RuoteKit.engine.wait_for(:toto)
RuoteKit.engine.wait_for(1)
@wi = RuoteKit.engine.storage_participant.first
RuoteKit.engine.cancel(@wfid)
RuoteKit.engine.wait_for('terminated')
@wi.h.delete('_rev')
RuoteKit.engine.storage.put(@wi.h)
end
after(:all) do
shutdown_and_purge_engine
end
describe 'GET /_ruote/processes' do
it 'does not list the process' do
get '/_ruote/processes.json'
last_response.status.should == 200
last_response.json_body['processes'].should == []
end
end
describe 'GET /_ruote/workitems' do
it 'lists the orphan workitem' do
get '/_ruote/workitems.json'
last_response.status.should == 200
last_response.json_body['workitems'].size.should == 1
last_response.json_body['workitems'][0]['id'].should == @wi.sid
links = last_response.json_body['workitems'][0]['links']
link_for(links, 'self').should ==
"/_ruote/workitems/#{@wi.sid}"
link_for(links, '#expression').should ==
"/_ruote/expressions/#{@wi.sid}"
end
end
describe 'GET /_ruote/workitems/:wfid' do
it 'lists the orphan workitems' do
get "/_ruote/workitems/#{@wi.wfid}.json"
last_response.status.should == 200
last_response.json_body['workitems'].size.should == 1
last_response.json_body['workitems'][0]['id'].should == @wi.sid
end
end
describe 'GET /_ruote/workitems/:fei' do
it 'renders the workitem' do
get "/_ruote/workitems/#{@wi.sid}.json"
last_response.status.should == 200
links = last_response.json_body['links']
link_for(links, 'self').should == "/_ruote/workitems/#{@wi.sid}"
end
end
describe 'GET /_ruote/processes/:wfid' do
it 'goes 404 (HTML)' do
get "/_ruote/processes/#{@wi.wfid}"
last_response.status.should == 404
end
it 'goes 404 (JSON)' do
get "/_ruote/processes/#{@wi.wfid}.json"
last_response.status.should == 404
end
end
describe 'GET /_ruote/expressions/:fei' do
it 'goes 404' do
get "/_ruote/expressions/#{@wi.sid}.json"
last_response.status.should == 404
end
end
describe 'GET /_ruote/expressions/:wfid' do
it 'goes 404 (HTML)' do
get "/_ruote/expressions/#{@wi.wfid}"
last_response.status.should == 404
end
it 'goes 404 (JSON)' do
get "/_ruote/expressions/#{@wi.wfid}.json"
last_response.status.should == 404
end
end
end
end