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

SF Standup 3/4-3/5/2010

Jacob Maine
Friday, March 5, 2010

Help

“What’s the best way to test that an array contains another array?”

A custom matcher using array - other_array was suggested.

Interesting

The team that was having problems with Prototype response codes found a partial solution.

They sometimes call abort() on the request which triggers the callbacks with a 0 response code. They found that if they set transport.onreadystatechange = function() {}; before calling abort() they could skip the callbacks, and manually call whatever clean-up they needed. That Prototype interprets 0 as a success still sounds strange.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

2 Comments

  1. Stephan Wehner says:

    Not sure I understand the “Help” question. Is assert a1.include?(a2) good enough?

    $ irb
    irb(main):001:0> a = [ [1], [2,3], [4,5,6]]
    => [[1], [2, 3], [4, 5, 6]]
    irb(main):002:0> a.include?([2,3])
    => true
    irb(main):003:0> a.include?([1,2,3])
    => false

    Stephan

    March 5, 2010 at 12:07 pm

  2. Josh Susser says:

    The problem was how to test if an array includes the contents of another array, as opposed to including the other array object itself. Splatting the other array works fine:

    it “includes related tags”
    %w[ruby rails rspec testing].should include(*article.tags)
    end

    March 5, 2010 at 1:59 pm

Add New Comment Cancel reply

Your email address will not be published.

Jacob Maine

Jacob Maine
Boston

Recent Posts

  • Standup 2012/2/1: Speed kills
  • Standup 2012/1/31: The bleeding edge
  • Standup 1/30/2012: It’s all about sharing
Subscribe to Jacob's Feed

Author Topics

agile (14)
testing (6)
rails (2)
prototype (2)
jruby (1)
hpricot (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 >