-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
427e7f2
commit 6377062
Showing
10 changed files
with
195 additions
and
679 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Module Dependencies | ||
*/ | ||
|
||
var Superagent = require('superagent'); | ||
|
||
/** | ||
* Export the default `driver` | ||
*/ | ||
|
||
module.exports = driver; | ||
|
||
/** | ||
* Initialize the default | ||
* `driver` makes an GET | ||
* request using superagent | ||
* | ||
* @param {Object} opts | ||
* @return {Function} plugin | ||
*/ | ||
|
||
function driver(opts) { | ||
var superagent = Superagent.agent(opts); | ||
|
||
return function plugin(xray) { | ||
|
||
xray.request = function request(url, fn) { | ||
superagent.get(url, function(err, res) { | ||
if (err) return fn(err); | ||
else return fn(null, res.text); | ||
}); | ||
}; | ||
|
||
return xray; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var assert = require('assert'); | ||
|
||
exports.input = [{ | ||
$root: '.repo-list-item', | ||
title: '.repo-list-name', | ||
link: '.repo-list-name a[href]', | ||
description: '.repo-list-description', | ||
meta: { | ||
$root: '.repo-list-meta', | ||
starredOn: 'time' | ||
} | ||
}]; | ||
|
||
exports.expected = function(arr) { | ||
assert(arr.length >= 60, 'array length (' + arr.length + ') not large enough'); | ||
arr.map(function(arr) { | ||
assert(~arr.link.indexOf('https://github.com/'), 'invalid link'); | ||
assert(arr.title.length, 'title not there'); | ||
assert(arr.meta.starredOn.length, 'starred on not there'); | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
exports.input = [{ | ||
$root: ".item", | ||
link: 'a[href]', | ||
thumb: 'img[src]', | ||
content: { | ||
$root: '.item-content', | ||
title: 'h2', | ||
body: 'section' | ||
}, | ||
tags: ['.item-tags li'] | ||
}]; | ||
|
||
exports.expected = { | ||
link: 'http://ift.tt/1xIsboY', | ||
thumb: 'http://www.google.com/s2/favicons?domain=http://ift.tt/1xIsboY', | ||
content: | ||
{ title: 'The 100 Best Children\'s Books of All Time', | ||
body: 'Relive your childhood with TIME\'s list of the best 100 children\'s books of all time http://t.co/NEvBhNM4np http://ift.tt/1sk3xdM\n\n— TIME.com (@TIME) January 11, 2015' }, | ||
tags: [ 'twitter' ] | ||
} |
Empty file.
Oops, something went wrong.