sbsm 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +515 -0
- data/History.txt +5 -0
- data/Manifest.txt +49 -0
- data/README.txt +41 -0
- data/Rakefile +28 -0
- data/data/_flavored_uri.grammar +24 -0
- data/data/_uri.grammar +22 -0
- data/data/_zone_uri.grammar +24 -0
- data/data/flavored_uri.grammar +24 -0
- data/data/uri.grammar +22 -0
- data/data/zone_uri.grammar +24 -0
- data/install.rb +1098 -0
- data/lib/cgi/drbsession.rb +37 -0
- data/lib/sbsm/cgi.rb +79 -0
- data/lib/sbsm/drb.rb +19 -0
- data/lib/sbsm/drbserver.rb +162 -0
- data/lib/sbsm/exception.rb +28 -0
- data/lib/sbsm/flavored_uri_parser.rb +47 -0
- data/lib/sbsm/index.rb +66 -0
- data/lib/sbsm/lookandfeel.rb +176 -0
- data/lib/sbsm/lookandfeelfactory.rb +50 -0
- data/lib/sbsm/lookandfeelwrapper.rb +109 -0
- data/lib/sbsm/redefine_19_cookie.rb +4 -0
- data/lib/sbsm/redirector.rb +37 -0
- data/lib/sbsm/request.rb +162 -0
- data/lib/sbsm/session.rb +542 -0
- data/lib/sbsm/state.rb +301 -0
- data/lib/sbsm/time.rb +29 -0
- data/lib/sbsm/trans_handler.rb +119 -0
- data/lib/sbsm/turing.rb +25 -0
- data/lib/sbsm/uri_parser.rb +45 -0
- data/lib/sbsm/user.rb +47 -0
- data/lib/sbsm/validator.rb +256 -0
- data/lib/sbsm/viralstate.rb +47 -0
- data/lib/sbsm/zone_uri_parser.rb +48 -0
- data/test/data/dos_file.txt +2 -0
- data/test/data/lnf_file.txt +2 -0
- data/test/data/mac_file.txt +1 -0
- data/test/stub/cgi.rb +35 -0
- data/test/suite.rb +29 -0
- data/test/test_drbserver.rb +83 -0
- data/test/test_index.rb +90 -0
- data/test/test_lookandfeel.rb +230 -0
- data/test/test_session.rb +372 -0
- data/test/test_state.rb +176 -0
- data/test/test_trans_handler.rb +447 -0
- data/test/test_user.rb +44 -0
- data/test/test_validator.rb +126 -0
- data/usage-en.txt +112 -0
- metadata +142 -0
@@ -0,0 +1,447 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# TestTransHandler -- sbsm -- 23.09.2004 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
$: << File.dirname(__FILE__)
|
5
|
+
$:.unshift File.expand_path('../lib', File.dirname(__FILE__))
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
require 'sbsm/trans_handler'
|
9
|
+
require 'cgi'
|
10
|
+
require 'fileutils'
|
11
|
+
|
12
|
+
module Apache
|
13
|
+
DECLINED = 0
|
14
|
+
end
|
15
|
+
module SBSM
|
16
|
+
class TestTransHandler < Test::Unit::TestCase
|
17
|
+
class RequestStub
|
18
|
+
attr_accessor :uri, :notes, :server
|
19
|
+
end
|
20
|
+
class ServerStub
|
21
|
+
attr_accessor :document_root
|
22
|
+
def log_notice(fmt, *args)
|
23
|
+
end
|
24
|
+
def log_warn(*args)
|
25
|
+
warn(args.join(' - '))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
class NotesStub < Hash
|
29
|
+
alias :add :store
|
30
|
+
end
|
31
|
+
def setup
|
32
|
+
@doc_root = File.expand_path('data/htdoc', File.dirname(__FILE__))
|
33
|
+
@etc_path = File.expand_path('../etc', @doc_root)
|
34
|
+
@doc_root.taint
|
35
|
+
end
|
36
|
+
def teardown
|
37
|
+
FileUtils.rm_r(@etc_path) if(File.exist?(@etc_path))
|
38
|
+
end
|
39
|
+
def test_parser_name
|
40
|
+
assert_equal('uri', TransHandler.instance.parser_name)
|
41
|
+
assert_equal('flavored_uri',
|
42
|
+
FlavoredTransHandler.instance.parser_name)
|
43
|
+
assert_not_equal(TransHandler.instance.uri_parser,
|
44
|
+
FlavoredTransHandler.instance.uri_parser)
|
45
|
+
end
|
46
|
+
def test_translate_uri
|
47
|
+
request = RequestStub.new
|
48
|
+
request.server = ServerStub.new
|
49
|
+
|
50
|
+
request.uri = '/'
|
51
|
+
request.notes = NotesStub.new
|
52
|
+
TransHandler.instance.translate_uri(request)
|
53
|
+
assert_equal({}, request.notes)
|
54
|
+
assert_equal('/index.rbx', request.uri)
|
55
|
+
|
56
|
+
request.uri = '/fr'
|
57
|
+
request.notes = NotesStub.new
|
58
|
+
TransHandler.instance.translate_uri(request)
|
59
|
+
assert_equal({'language' => 'fr'}, request.notes)
|
60
|
+
assert_equal('/index.rbx', request.uri)
|
61
|
+
|
62
|
+
request.uri = '/en/'
|
63
|
+
request.notes = NotesStub.new
|
64
|
+
TransHandler.instance.translate_uri(request)
|
65
|
+
assert_equal({'language' => 'en'}, request.notes)
|
66
|
+
assert_equal('/index.rbx', request.uri)
|
67
|
+
|
68
|
+
request.uri = '/de/search/state_id/407422388/search_query/ponstan'
|
69
|
+
request.notes = NotesStub.new
|
70
|
+
TransHandler.instance.translate_uri(request)
|
71
|
+
expected = {
|
72
|
+
'language' => 'de',
|
73
|
+
'event' => 'search',
|
74
|
+
'state_id' => '407422388',
|
75
|
+
'search_query'=> 'ponstan',
|
76
|
+
}
|
77
|
+
assert_equal(expected, request.notes)
|
78
|
+
assert_equal('/index.rbx', request.uri)
|
79
|
+
|
80
|
+
request.uri = '/de/search/state_id/407422388/search_query/ponstan/page/4'
|
81
|
+
request.notes = NotesStub.new
|
82
|
+
TransHandler.instance.translate_uri(request)
|
83
|
+
expected = {
|
84
|
+
'language' => 'de',
|
85
|
+
'event' => 'search',
|
86
|
+
'state_id' => '407422388',
|
87
|
+
'search_query'=> 'ponstan',
|
88
|
+
'page' => '4',
|
89
|
+
}
|
90
|
+
assert_equal(expected, request.notes)
|
91
|
+
assert_equal('/index.rbx', request.uri)
|
92
|
+
|
93
|
+
request.uri = '/de/search/pretty//state_id/407422388/search_query/ponstan/page/4'
|
94
|
+
request.notes = NotesStub.new
|
95
|
+
expected = '/index.rbx?language=de&event=search&pretty=&state_id=407422388&search_query=ponstan&page=4'
|
96
|
+
TransHandler.instance.translate_uri(request)
|
97
|
+
expected = {
|
98
|
+
'language' => 'de',
|
99
|
+
'event' => 'search',
|
100
|
+
'pretty' => '',
|
101
|
+
'state_id' => '407422388',
|
102
|
+
'search_query'=> 'ponstan',
|
103
|
+
'page' => '4',
|
104
|
+
}
|
105
|
+
assert_equal(expected, request.notes)
|
106
|
+
assert_equal('/index.rbx', request.uri)
|
107
|
+
|
108
|
+
request.uri = '/de/search/search_query/'
|
109
|
+
request.notes = NotesStub.new
|
110
|
+
TransHandler.instance.translate_uri(request)
|
111
|
+
expected = {
|
112
|
+
'language' => 'de',
|
113
|
+
'event' => 'search',
|
114
|
+
'search_query'=> '',
|
115
|
+
}
|
116
|
+
assert_equal(expected, request.notes)
|
117
|
+
assert_equal('/index.rbx', request.uri)
|
118
|
+
end
|
119
|
+
def test_translate_uri__shortcut
|
120
|
+
request = RequestStub.new
|
121
|
+
request.server = ServerStub.new
|
122
|
+
request.server.document_root = @doc_root
|
123
|
+
|
124
|
+
request.uri = '/shortcut'
|
125
|
+
request.notes = NotesStub.new
|
126
|
+
assert_nothing_raised {
|
127
|
+
TransHandler.instance.translate_uri(request)
|
128
|
+
}
|
129
|
+
assert_equal({}, request.notes)
|
130
|
+
assert_equal('/shortcut', request.uri)
|
131
|
+
|
132
|
+
FileUtils.mkdir_p(@etc_path)
|
133
|
+
shortcut = File.join(@etc_path, 'trans_handler.yml')
|
134
|
+
File.open(shortcut, 'w') { |fh|
|
135
|
+
fh.puts <<-EOS
|
136
|
+
---
|
137
|
+
shortcut:
|
138
|
+
/somewhere:
|
139
|
+
over: the rainbow
|
140
|
+
goodbye: yellow brick road
|
141
|
+
/shortcut:
|
142
|
+
shortcut: variables
|
143
|
+
EOS
|
144
|
+
}
|
145
|
+
|
146
|
+
request.uri = '/shortcut'
|
147
|
+
request.notes = NotesStub.new
|
148
|
+
assert_nothing_raised {
|
149
|
+
# run in safe-mode
|
150
|
+
Thread.new {
|
151
|
+
$SAFE = 1
|
152
|
+
TransHandler.instance.translate_uri(request)
|
153
|
+
}.join
|
154
|
+
}
|
155
|
+
assert_equal({'shortcut' => 'variables'}, request.notes)
|
156
|
+
assert_equal('/index.rbx', request.uri)
|
157
|
+
|
158
|
+
request.uri = '/somewhere'
|
159
|
+
request.notes = NotesStub.new
|
160
|
+
TransHandler.instance.translate_uri(request)
|
161
|
+
expected = {
|
162
|
+
'over' => 'the rainbow',
|
163
|
+
'goodbye' => 'yellow brick road',
|
164
|
+
}
|
165
|
+
assert_equal(expected, request.notes)
|
166
|
+
assert_equal('/index.rbx', request.uri)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
class TestFlavoredTransHandler < Test::Unit::TestCase
|
170
|
+
class RequestStub
|
171
|
+
attr_accessor :uri, :notes, :server
|
172
|
+
end
|
173
|
+
class ServerStub
|
174
|
+
attr_accessor :document_root
|
175
|
+
def log_notice(fmt, *args)
|
176
|
+
end
|
177
|
+
def log_warn(*args)
|
178
|
+
warn(args.join(' - '))
|
179
|
+
end
|
180
|
+
end
|
181
|
+
class NotesStub < Hash
|
182
|
+
alias :add :store
|
183
|
+
end
|
184
|
+
def setup
|
185
|
+
@doc_root = File.expand_path('data/htdoc', File.dirname(__FILE__))
|
186
|
+
@etc_path = File.expand_path('../etc', @doc_root)
|
187
|
+
@doc_root.taint
|
188
|
+
end
|
189
|
+
def teardown
|
190
|
+
FileUtils.rm_r(@etc_path) if(File.exist?(@etc_path))
|
191
|
+
end
|
192
|
+
def test_translate_uri
|
193
|
+
request = RequestStub.new
|
194
|
+
request.server = ServerStub.new
|
195
|
+
|
196
|
+
request.uri = '/'
|
197
|
+
request.notes = NotesStub.new
|
198
|
+
FlavoredTransHandler.instance.translate_uri(request)
|
199
|
+
assert_equal({}, request.notes)
|
200
|
+
assert_equal('/index.rbx', request.uri)
|
201
|
+
|
202
|
+
request.uri = '/fr'
|
203
|
+
request.notes = NotesStub.new
|
204
|
+
FlavoredTransHandler.instance.translate_uri(request)
|
205
|
+
assert_equal({'language' => 'fr'}, request.notes)
|
206
|
+
assert_equal('/index.rbx', request.uri)
|
207
|
+
|
208
|
+
request.uri = '/en/'
|
209
|
+
request.notes = NotesStub.new
|
210
|
+
FlavoredTransHandler.instance.translate_uri(request)
|
211
|
+
assert_equal({'language' => 'en'}, request.notes)
|
212
|
+
assert_equal('/index.rbx', request.uri)
|
213
|
+
|
214
|
+
request.uri = '/en/flavor'
|
215
|
+
request.notes = NotesStub.new
|
216
|
+
FlavoredTransHandler.instance.translate_uri(request)
|
217
|
+
expected = {
|
218
|
+
'language'=> 'en',
|
219
|
+
'flavor' => 'flavor',
|
220
|
+
}
|
221
|
+
assert_equal(expected, request.notes)
|
222
|
+
assert_equal('/index.rbx', request.uri)
|
223
|
+
|
224
|
+
request.uri = '/en/other'
|
225
|
+
request.notes = NotesStub.new
|
226
|
+
FlavoredTransHandler.instance.translate_uri(request)
|
227
|
+
expected = {
|
228
|
+
'language'=> 'en',
|
229
|
+
'flavor' => 'other',
|
230
|
+
}
|
231
|
+
assert_equal(expected, request.notes)
|
232
|
+
assert_equal('/index.rbx', request.uri)
|
233
|
+
|
234
|
+
request.uri = '/de/gcc/search/state_id/407422388/search_query/ponstan'
|
235
|
+
request.notes = NotesStub.new
|
236
|
+
FlavoredTransHandler.instance.translate_uri(request)
|
237
|
+
expected = {
|
238
|
+
'language' => 'de',
|
239
|
+
'flavor' => 'gcc',
|
240
|
+
'event' => 'search',
|
241
|
+
'state_id' => '407422388',
|
242
|
+
'search_query'=> 'ponstan',
|
243
|
+
}
|
244
|
+
assert_equal(expected, request.notes)
|
245
|
+
assert_equal('/index.rbx', request.uri)
|
246
|
+
|
247
|
+
request.uri = '/de/gcc/search/state_id/407422388/search_query/ponstan/page/4'
|
248
|
+
request.notes = NotesStub.new
|
249
|
+
FlavoredTransHandler.instance.translate_uri(request)
|
250
|
+
expected = {
|
251
|
+
'language' => 'de',
|
252
|
+
'flavor' => 'gcc',
|
253
|
+
'event' => 'search',
|
254
|
+
'state_id' => '407422388',
|
255
|
+
'search_query'=> 'ponstan',
|
256
|
+
'page' => '4',
|
257
|
+
}
|
258
|
+
assert_equal(expected, request.notes)
|
259
|
+
assert_equal('/index.rbx', request.uri)
|
260
|
+
|
261
|
+
request.uri = '/de/gcc/search/pretty//state_id/407422388/search_query/ponstan/page/4'
|
262
|
+
request.notes = NotesStub.new
|
263
|
+
expected = '/index.rbx?language=de&flavor=gcc&event=search&pretty=&state_id=407422388&search_query=ponstan&page=4'
|
264
|
+
FlavoredTransHandler.instance.translate_uri(request)
|
265
|
+
expected = {
|
266
|
+
'language' => 'de',
|
267
|
+
'flavor' => 'gcc',
|
268
|
+
'event' => 'search',
|
269
|
+
'pretty' => '',
|
270
|
+
'state_id' => '407422388',
|
271
|
+
'search_query'=> 'ponstan',
|
272
|
+
'page' => '4',
|
273
|
+
}
|
274
|
+
assert_equal(expected, request.notes)
|
275
|
+
assert_equal('/index.rbx', request.uri)
|
276
|
+
|
277
|
+
request.uri = '/de/gcc/search/search_query/'
|
278
|
+
request.notes = NotesStub.new
|
279
|
+
FlavoredTransHandler.instance.translate_uri(request)
|
280
|
+
expected = {
|
281
|
+
'language' => 'de',
|
282
|
+
'flavor' => 'gcc',
|
283
|
+
'event' => 'search',
|
284
|
+
'search_query'=> '',
|
285
|
+
}
|
286
|
+
assert_equal(expected, request.notes)
|
287
|
+
assert_equal('/index.rbx', request.uri)
|
288
|
+
end
|
289
|
+
def test_translate_uri__shortcut
|
290
|
+
request = RequestStub.new
|
291
|
+
request.server = ServerStub.new
|
292
|
+
request.server.document_root = @doc_root
|
293
|
+
|
294
|
+
request.uri = '/shortcut'
|
295
|
+
request.notes = NotesStub.new
|
296
|
+
assert_nothing_raised {
|
297
|
+
FlavoredTransHandler.instance.translate_uri(request)
|
298
|
+
}
|
299
|
+
assert_equal({}, request.notes)
|
300
|
+
assert_equal('/shortcut', request.uri)
|
301
|
+
|
302
|
+
FileUtils.mkdir_p(@etc_path)
|
303
|
+
shortcut = File.join(@etc_path, 'trans_handler.yml')
|
304
|
+
File.open(shortcut, 'w') { |fh|
|
305
|
+
fh.puts <<-EOS
|
306
|
+
---
|
307
|
+
shortcut:
|
308
|
+
/somewhere:
|
309
|
+
over: the rainbow
|
310
|
+
goodbye: yellow brick road
|
311
|
+
/shortcut:
|
312
|
+
shortcut: variables
|
313
|
+
EOS
|
314
|
+
}
|
315
|
+
|
316
|
+
request.uri = '/shortcut'
|
317
|
+
request.notes = NotesStub.new
|
318
|
+
assert_nothing_raised {
|
319
|
+
# run in safe-mode
|
320
|
+
Thread.new {
|
321
|
+
$SAFE = 1
|
322
|
+
FlavoredTransHandler.instance.translate_uri(request)
|
323
|
+
}.join
|
324
|
+
}
|
325
|
+
assert_equal({'shortcut' => 'variables'}, request.notes)
|
326
|
+
assert_equal('/index.rbx', request.uri)
|
327
|
+
|
328
|
+
request.uri = '/somewhere'
|
329
|
+
request.notes = NotesStub.new
|
330
|
+
FlavoredTransHandler.instance.translate_uri(request)
|
331
|
+
expected = {
|
332
|
+
'over' => 'the rainbow',
|
333
|
+
'goodbye' => 'yellow brick road',
|
334
|
+
}
|
335
|
+
assert_equal(expected, request.notes)
|
336
|
+
assert_equal('/index.rbx', request.uri)
|
337
|
+
end
|
338
|
+
end
|
339
|
+
class TestZoneTransHandler < Test::Unit::TestCase
|
340
|
+
class RequestStub
|
341
|
+
attr_accessor :uri, :notes, :server
|
342
|
+
end
|
343
|
+
class ServerStub
|
344
|
+
attr_accessor :document_root
|
345
|
+
def log_notice(fmt, *args)
|
346
|
+
end
|
347
|
+
def log_warn(*args)
|
348
|
+
warn(args.join(' - '))
|
349
|
+
end
|
350
|
+
end
|
351
|
+
class NotesStub < Hash
|
352
|
+
alias :add :store
|
353
|
+
end
|
354
|
+
def setup
|
355
|
+
@doc_root = File.expand_path('data/htdoc', File.dirname(__FILE__))
|
356
|
+
@etc_path = File.expand_path('../etc', @doc_root)
|
357
|
+
@doc_root.taint
|
358
|
+
end
|
359
|
+
def teardown
|
360
|
+
FileUtils.rm_r(@etc_path) if(File.exist?(@etc_path))
|
361
|
+
end
|
362
|
+
def test_translate_uri
|
363
|
+
request = RequestStub.new
|
364
|
+
request.server = ServerStub.new
|
365
|
+
|
366
|
+
request.uri = '/'
|
367
|
+
request.notes = NotesStub.new
|
368
|
+
ZoneTransHandler.instance.translate_uri(request)
|
369
|
+
assert_equal({}, request.notes)
|
370
|
+
assert_equal('/index.rbx', request.uri)
|
371
|
+
|
372
|
+
request.uri = '/fr'
|
373
|
+
request.notes = NotesStub.new
|
374
|
+
ZoneTransHandler.instance.translate_uri(request)
|
375
|
+
assert_equal({'language' => 'fr'}, request.notes)
|
376
|
+
assert_equal('/index.rbx', request.uri)
|
377
|
+
|
378
|
+
request.uri = '/en/'
|
379
|
+
request.notes = NotesStub.new
|
380
|
+
ZoneTransHandler.instance.translate_uri(request)
|
381
|
+
assert_equal({'language' => 'en'}, request.notes)
|
382
|
+
assert_equal('/index.rbx', request.uri)
|
383
|
+
|
384
|
+
request.uri = '/en/zone'
|
385
|
+
request.notes = NotesStub.new
|
386
|
+
ZoneTransHandler.instance.translate_uri(request)
|
387
|
+
expected = {
|
388
|
+
'language'=> 'en',
|
389
|
+
'zone' => 'zone',
|
390
|
+
}
|
391
|
+
assert_equal(expected, request.notes)
|
392
|
+
assert_equal('/index.rbx', request.uri)
|
393
|
+
|
394
|
+
request.uri = '/en/other'
|
395
|
+
request.notes = NotesStub.new
|
396
|
+
ZoneTransHandler.instance.translate_uri(request)
|
397
|
+
expected = {
|
398
|
+
'language'=> 'en',
|
399
|
+
'zone' => 'other',
|
400
|
+
}
|
401
|
+
assert_equal(expected, request.notes)
|
402
|
+
assert_equal('/index.rbx', request.uri)
|
403
|
+
|
404
|
+
request.uri = '/de/gcc/search/state_id/407422388/search_query/ponstan/page/4'
|
405
|
+
request.notes = NotesStub.new
|
406
|
+
ZoneTransHandler.instance.translate_uri(request)
|
407
|
+
expected = {
|
408
|
+
'language' => 'de',
|
409
|
+
'zone' => 'gcc',
|
410
|
+
'event' => 'search',
|
411
|
+
'state_id' => '407422388',
|
412
|
+
'search_query'=> 'ponstan',
|
413
|
+
'page' => '4',
|
414
|
+
}
|
415
|
+
assert_equal(expected, request.notes)
|
416
|
+
assert_equal('/index.rbx', request.uri)
|
417
|
+
|
418
|
+
request.uri = '/de/gcc/search/pretty//state_id/407422388/search_query/ponstan/page/4'
|
419
|
+
request.notes = NotesStub.new
|
420
|
+
expected = '/index.rbx?language=de&zone=gcc&event=search&detail=objid&pretty=&state_id=407422388&search_query=ponstan&page=4'
|
421
|
+
ZoneTransHandler.instance.translate_uri(request)
|
422
|
+
expected = {
|
423
|
+
'language' => 'de',
|
424
|
+
'zone' => 'gcc',
|
425
|
+
'event' => 'search',
|
426
|
+
'pretty' => '',
|
427
|
+
'state_id' => '407422388',
|
428
|
+
'search_query'=> 'ponstan',
|
429
|
+
'page' => '4',
|
430
|
+
}
|
431
|
+
assert_equal(expected, request.notes)
|
432
|
+
assert_equal('/index.rbx', request.uri)
|
433
|
+
|
434
|
+
request.uri = '/de/gcc/search/search_query/'
|
435
|
+
request.notes = NotesStub.new
|
436
|
+
ZoneTransHandler.instance.translate_uri(request)
|
437
|
+
expected = {
|
438
|
+
'language' => 'de',
|
439
|
+
'zone' => 'gcc',
|
440
|
+
'event' => 'search',
|
441
|
+
'search_query'=> '',
|
442
|
+
}
|
443
|
+
assert_equal(expected, request.notes)
|
444
|
+
assert_equal('/index.rbx', request.uri)
|
445
|
+
end
|
446
|
+
end
|
447
|
+
end
|
data/test/test_user.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# State Based Session Management
|
4
|
+
# Copyright (C) 2004 Hannes Wyss
|
5
|
+
#
|
6
|
+
# This library is free software; you can redistribute it and/or
|
7
|
+
# modify it under the terms of the GNU Lesser General Public
|
8
|
+
# License as published by the Free Software Foundation; either
|
9
|
+
# version 2.1 of the License, or (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This library is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
# Lesser General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Lesser General Public
|
17
|
+
# License along with this library; if not, write to the Free Software
|
18
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
+
#
|
20
|
+
# ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Z�rich, Switzerland
|
21
|
+
# hwyss@ywesee.com
|
22
|
+
#
|
23
|
+
# TestUser -- sbsm -- 20.11.2002 -- hwyss@ywesee.com
|
24
|
+
|
25
|
+
$: << File.dirname(__FILE__)
|
26
|
+
$: << File.expand_path("../lib", File.dirname(__FILE__))
|
27
|
+
|
28
|
+
require 'test/unit'
|
29
|
+
require 'sbsm/user'
|
30
|
+
require 'sbsm/state'
|
31
|
+
|
32
|
+
class StubUserState < SBSM::State; end
|
33
|
+
class User < SBSM::User
|
34
|
+
NAVIGATION = [StubUserState]
|
35
|
+
end
|
36
|
+
|
37
|
+
class TestUser < Test::Unit::TestCase
|
38
|
+
def setup
|
39
|
+
@user = User.new
|
40
|
+
end
|
41
|
+
def test_navigation
|
42
|
+
assert_equal([StubUserState], @user.navigation)
|
43
|
+
end
|
44
|
+
end
|