Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Standup 11/4/2010: sweeping-up-the-ticker-tape edition

Is it possible in Jasmine to spy on a getter such as myObject[key]? We want to know when local storage is accessed.

No. Jasmine‘s spyOn only works with functions, and in JavaScript getters are not implemented as functions.

Local storage has a functionally equivalent getValue function, which you can spy on, but the spy is not triggered when you access the value via [].


  • On unicorn, the random number generator is seeded before the fork. So if you are depending on a set of unicorns to generate different random numbers, you need to reseed the random number generator manually after the fork.

  • If you want to make absolutely sure you aren’t generating any queries in your Rails views, try no_querying_views – which explodes if your query comes from view code.

  • Other ways to track down inefficient queries that folks have successfully used: bullet and query_reviewer

  • Skype 5 beta is out for Mac, which allows group video chat. Everyone must be on the beta for it to work.

  1. Franck says:

    Thanks for mentioning no_querying_views Sarah!

  2. Rajan Agaskar says:

    If you’re using local storage (not 100% sure what that refers to, but am assuming some sort of browser-based data store), why not write a thin wrapper around it, then spy on that wrapper? That should solve your spying problem, and then if you ever need to switch it out/add cross-browser compatibility, you’re all set.

    This might be bad advice depending on what you’re actually trying to test, but I thought I’d mention that in most cases I’d be more interested in what’s actually in the data store rather than throwing a spy/mock expectation into the mix. Run your logic, then check the data — is it what you expected? Pass.

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *