Hi Benjamin,
just tested your code and I also get an infinite recursion. Not sure why (will
take a closer look), but here is another approach using stubs.
"test: stub environment setting": function() {
var setting = this.stub(qx.core.Environment, "get").withArgs("browser.name");
setting.returns("My Browser");
this.assertEquals("My Browser", qx.core.Environment.get("browser.name"));
},
(Taken from qx.test.dev.unit.Sinon, you'll find more examples there)
By the way: Just recently, I added a section to the manual about spies, stubs
and mocks. See
https://github.com/qooxdoo/qooxdoo/commit/1d1f21b3a13941123c4e2ac24c87bdc2fb813611.
Regards
Tristan
Am 11.11.2011 um 19:51 schrieb Benjamin Dreux:
> Hi
> After reading the sinonjs api, made up this call
>
> var mockEnv =
> this.mock(qx.core.Environment).expects("get").withArgs("username").returns("usernmae");
>
> To mock the environnement for a special call.
> But when I run my unit test (wich execute this mocking), the execution
> hang on infinitly.
>
>
> Do i use sinon correctly??
>
> Regards
>
> --
> Benjamin Dreux
> Analyste-Programmeur
> Chaire de logiciel libre-Finance Social et solidaire
> UQAM
> Montréal
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel