Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Jasmine Clock setTimeout implementation failure

Received: by 10.14.215.136 with SMTP id e8mr39679877eep.6.1351791521387;
        Thu, 01 Nov 2012 10:38:41 -0700 (PDT)
X-BeenThere: jasmine-js@googlegroups.com
Received: by 10.14.173.67 with SMTP id u43ls2201744eel.8.gmail; Thu, 01 Nov
 2012 10:38:36 -0700 (PDT)
Received: by 10.14.204.3 with SMTP id g3mr46597059eeo.7.1351791516213;
        Thu, 01 Nov 2012 10:38:36 -0700 (PDT)
Received: by 10.14.204.3 with SMTP id g3mr46597058eeo.7.1351791516201;
        Thu, 01 Nov 2012 10:38:36 -0700 (PDT)
Return-Path: <ra...@pivotallabs.com>
Received: from mail-ee0-f51.google.com (mail-ee0-f51.google.com [74.125.83.51])
        by gmr-mx.google.com with ESMTPS id u8si837808een.1.2012.11.01.10.38.34
        (version=TLSv1/SSLv3 cipher=OTHER);
        Thu, 01 Nov 2012 10:38:34 -0700 (PDT)
Received-SPF: pass (google.com: domain of ra...@pivotallabs.com designates 74.125.83.51 as permitted sender) client-ip=74.125.83.51;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of ra...@pivotallabs.com designates 74.125.83.51 as permitted sender) smtp.mail=ra...@pivotallabs.com
Received: by mail-ee0-f51.google.com with SMTP id d49so1535650eek.24
        for <jasmine-js@googlegroups.com>; Thu, 01 Nov 2012 10:38:34 -0700 (PDT)
        d=google.com; s=20120113;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :content-type:x-gm-message-state;
        bh=cpRcyphohWVT6NMYEPnUCt+wEAcFNTzcAy08n1d0L4g=;
        b=QAS6IBWIrb6JEZhLyZkWg2t56S04HRw7fVaiUiHWqY/5RmrHcqbcmzpGxCWP6LhY3S
         DTdb5aP06E/7+Wf3gz7hOHtlnd3HbiP/d0gye8gMAU6Y8m3aos/Y+ugWzmVFKqiNqTWJ
         vBTS3D202fjH9cwlq67jxwgHQKHzRIPnjoKAfeQAb0y90uWBRg259j4DEPF6A17MWKbL
         ZU7wL9upkACM82QpvoyXj/gnhd7wVlN7RAIIKlSZYJCSfjlBdrJyIp/D47cc2p7e1V2m
         9cmBhIHM5mSpLC5lT9HKs+ZYzzEbpQmVt3JAhWIVlEPSZ0bdD1gG+oajwdBwHKOdw/Vb
         zKbA==
MIME-Version: 1.0
Received: by 10.14.200.134 with SMTP id z6mr99710018een.33.1351791514752; Thu,
 01 Nov 2012 10:38:34 -0700 (PDT)
Received: by 10.223.132.210 with HTTP; Thu, 1 Nov 2012 10:38:34 -0700 (PDT)
In-Reply-To: <4b9ea95b-9403-475c-801f-ff8cda958fc3@googlegroups.com>
References: <21ea41f4-f007-4ea5-beb8-7c03854aa998@googlegroups.com>
	<4b9ea95b-9403-475c-801f-ff8cda958fc3@googlegroups.com>
Date: Thu, 1 Nov 2012 10:38:34 -0700
Message-ID: <CAJgj9bDoCvPzhFJ6nH0asj2ZrdPNt9EFKcDnHUUpcuqo1pD...@mail.gmail.com>
Subject: Re: [jasmine-js] Re: Jasmine Clock setTimeout implementation failure
From: Rajan Agaskar <ra...@pivotallabs.com>
To: jasmine-js@googlegroups.com
Content-Type: text/plain; charset=ISO-8859-1
X-Gm-Message-State: ALoCoQkdDREuZ/G3reFWhbaTeAcOzjHi9OXjENs4wlPZZ+G2Qufyo29DMVT48j18xs+RsD0kDBNS

On my really brief reading, I'm wondering if your _cfg ref doesn't get
correctly extended?

_updateConfig = function(cfgIn) {
      return $.extend(true, _cfg, cfgIn);
    };

The way I'm reading this (post-conversion to js), is that it's
creating a new object (true) and extending that with _cfg (default
cfg) and cfgln (passed cfg), not updating your original _cfg ref.

Thus your _cfg ref in requestValue wouldn't get updated with the
passed client which would explain why the stub client isn't called.

That said, I would also expect the requestValue method to explode
because cfg.client would be undef'd.

I think the easiest approach is to just throw a debugger in your
requestValue method and poke at the _cfg vals.

Thanks!

Rajan



On Thu, Nov 1, 2012 at 7:33 AM, Brandon Wilburn
<techie.bran...@yahoo.com> wrote:
> As a response to your other lines of thought:
>   - I am working against jasmine-node (downloaded from npm yesterday)
>   - This test/suite is being ran in isolation (you have full suite on prior
> msg)
>   - below are my other libraries in play:
>
>   "dependencies": {
>     "express": "3.0.0rc4",
>     "coffee-script": "1.3.3",
>     "redis": "0.8.1",
>     "hiredis": "0.1.14",
>     "socket.io": "0.9.10",
>     "moment": "1.7.2",
>     "xml2js": "0.2.0",
>     "jquery": "1.7.3",
>     "knockout": "2.1.0",
>     "underscore": "1.4.2",
>     "jade": "0.27.6",
>     "consolidate": "0.4.0",
>     "underscore.string": "2.3.0",
>     "nodetime": "0.4.7",
>     "jasmine-node": "1.0.26",
>     "should": "1.2.0"
>   }
>
> On Thursday, November 1, 2012 1:02:06 AM UTC-5, Brandon Wilburn wrote:
>>
>> I hate to repost across multiple forums but I haven't get any response
>> from Stackoverflow so thought it worth a shot here.
>>
>>
>> http://stackoverflow.com/questions/13167741/jasmine-coffeescript-clock-not-effective
>>
>> I am getting no joy from my jasmine.Clock. My expectation is that the code
>> will mock out the clock object and will trigger setTimeout events upon
>> setting the tick past the specified intervals in the setTimeout, however
>> this does not seem to be working and I cannot find my flaw. My code seems to
>> be parallel to others applying the same clock control behavior.
>>
>> Background: the 'callback' function sets the this.action.state() to
>> Constants.state.Ready after execution, prior it should be
>> Constants.state.WAITING. Please note I am using knockout observables; the
>> state is supposed to be called as a fx to retrieve value.
>>
>> describe "Redis GET Action", () ->
>>   beforeEach () ->
>>     jasmine.Clock.useMock();
>>     this.getReturnValue = getReturnValue = "Some jasmine values from
>> redis"
>>     clientStub =
>>       get: (key,callback) ->
>>         if callback?
>>           setTimeout(callback(undefined, getReturnValue),1500)
>>       GET: (key,callback) ->
>>         if callback?
>>           setTimeout(callback(undefined, getReturnValue),1500)
>>
>>     this.action = new RedisGetAction(
>>       client: clientStub
>>       key: "Standard"
>>       )
>>
>>
>>   it "should return a object", () ->
>>     expect(this.action).toEqual(jasmine.any(Object))
>>
>>   requiredMethods = ['state','data','params'];
>>
>>   requiredMethods.forEach (methodName) ->
>>     it "should have public "+methodName+" method", () ->
>>       expect(this.action[methodName]).toBeDefined();
>>
>>   it "should initialize with public accessible state of
>> #{Constants.state.WAITING}", () ->
>>     expect(this.action.state()).toEqual(Constants.state.WAITING)
>>     jasmine.Clock.tick(1501);
>>     expect(this.action.state()).toEqual(Constants.state.READY)
>>
>> Results: Failures:
>>
>>    1) should initialize with public accessible state of waiting
>>        Message:
>>          Expected 'ready' to equal 'waiting'.
>>        Stacktrace:
>>          Error: Expected 'ready' to equal 'waiting'.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jasmine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/jasmine-js/-/txfnvQJI7f4J.
>
> To post to this group, send email to jasmine-js@googlegroups.com.
> To unsubscribe from this group, send email to
> jasmine-js+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jasmine-js?hl=en.