[Seaside-dev] Testing trouble
Diego Lont
diego.lont at delware.nl
Fri Jan 11 09:59:55 UTC 2013
Hi all,
I have a problem in testing my code. I have a user in my session I want to use for logging changes (among other things). By default I can access the user in a WAObject by the following code:
self session user.
When I now write a test, this code crashes on a doesNotUnderstand on #session. In WAObject the requestContext is nil, because it is not in a request (it is in a test) and I have no session. I want to include one fix in WAObject:
session
"Answer the current seaside session, instance of WASesssion or a subclass."
self requestContext ifNotNilDo: [ :context | ^context session ].
^nil
And the same trick in my own code saying:
user
"Answer the current seaside session, instance of WASesssion or a subclass."
self session ifNotNilDo: [ :session | ^session user ].
^nil
In this way I have no trouble in testing my code.
Does this change make sense to you too?
Cheers,
Diego
More information about the seaside-dev
mailing list