12/19/2010 - 7:05 PM


'We make sure we can talk to Twitter':
    /* We'll be using same server for following requests. */
            .expect(200, "ok", "/help/test.json returns 200 and ok")
            /* Here we ignore response */
            .expect(406, dc.ignore(), "/help/test.txt is not acceptable"),

'We need to know what are the hot trends in the twittersphere':
            /* We want to make sure a structure is returned ... */
            .expect(200, {
                /* ... it has as_of key whose value matches regexp. */
                as_of: dc.RegEx(/\w+, \d+ \w+ \d+ \d+:\d+:\d+ \+\d+/),
                /* ... and has array with at least one structure
                 * with keys name and url whose values are not so
                 * important
                trends: [ { name: dc.ignore(), url: dc.ignore() } ]
            }, "/trends.json return 200 and reasonable answer",
            /* We can store the result and response for later */
            ['trend_rc', 'trend_resp'])
            /* And here we can refrence what we've stored in previous step */
            .expect(200, {
                /* Some keys are important for us. */
                results: [],
                query: dc.ignore(),
                max_id: dc.ignore()
            }, "We make sure we got what we were looking for.")