Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

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

Sarah Mei
Thursday, November 4, 2010

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 [].

Interesting:

  • 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.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

2 Comments

  1. Franck says:

    Thanks for mentioning no_querying_views Sarah!

    November 6, 2010 at 2:06 am

  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.

    November 6, 2010 at 6:18 am

Add New Comment Cancel reply

Your email address will not be published.

Sarah Mei

Sarah Mei
San Francisco

Recent Posts

  • Standup 11/5/2010: Happy Friday Edition
  • Oh look a parade!
  • Election Day Special!
Subscribe to Sarah's Feed

Author Topics

agile (7)
arel (1)
bundler (2)
cimonitor (1)
heroku (1)
git (2)
jasmine (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >