Comparing version 0.5.9 to 0.5.10
@@ -20,3 +20,3 @@ /* | ||
*/ | ||
/*************** AUTOGENERATED @ 1371014758626 *************** | ||
/*************** AUTOGENERATED @ 1371014966634 *************** | ||
WARNING: THIS FILE WAS AUTOGENERATED BY THE FAKER BUILD SCRIPT | ||
@@ -243,7 +243,8 @@ MODIFYING THIS FILE IS FINE, BUT YOU REALLY SHOULD BE MODIFYING | ||
Faker.Lorem.sentence = function (wordCount) { | ||
Faker.Lorem.sentence = function (wordCount, range) { | ||
if (typeof wordCount == 'undefined') { wordCount = 3; } | ||
if (typeof range == 'undefined') { range = 7; } | ||
// strange issue with the node_min_test failing for captialize, please fix and add this back | ||
//return this.words(wordCount + Helpers.randomNumber(7)).join(' ').capitalize(); | ||
//return this.words(wordCount + Helpers.randomNumber(range)).join(' ').capitalize(); | ||
@@ -250,0 +251,0 @@ return lorem.words(wordCount + Faker.random.number(7)).join(' '); |
@@ -20,3 +20,3 @@ /* | ||
*/ | ||
/*************** AUTOGENERATED @ 1371014758626 *************** | ||
/*************** AUTOGENERATED @ 1371014966634 *************** | ||
WARNING: THIS FILE WAS AUTOGENERATED BY THE FAKER BUILD SCRIPT | ||
@@ -243,7 +243,8 @@ MODIFYING THIS FILE IS FINE, BUT YOU REALLY SHOULD BE MODIFYING | ||
Faker.Lorem.sentence = function (wordCount) { | ||
Faker.Lorem.sentence = function (wordCount, range) { | ||
if (typeof wordCount == 'undefined') { wordCount = 3; } | ||
if (typeof range == 'undefined') { range = 7; } | ||
// strange issue with the node_min_test failing for captialize, please fix and add this back | ||
//return this.words(wordCount + Helpers.randomNumber(7)).join(' ').capitalize(); | ||
//return this.words(wordCount + Helpers.randomNumber(range)).join(' ').capitalize(); | ||
@@ -250,0 +251,0 @@ return lorem.words(wordCount + Faker.random.number(7)).join(' '); |
@@ -11,7 +11,8 @@ var Faker = require('../index'); | ||
sentence: function (wordCount) { | ||
sentence: function (wordCount, range) { | ||
if (typeof wordCount == 'undefined') { wordCount = 3; } | ||
if (typeof range == 'undefined') { range = 7; } | ||
// strange issue with the node_min_test failing for captialize, please fix and add this back | ||
//return this.words(wordCount + Helpers.randomNumber(7)).join(' ').capitalize(); | ||
//return this.words(wordCount + Helpers.randomNumber(range)).join(' ').capitalize(); | ||
@@ -18,0 +19,0 @@ return lorem.words(wordCount + Faker.random.number(7)).join(' '); |
{ | ||
"name": "Faker", | ||
"description": "Generate massive amounts of fake contextual data", | ||
"version": "0.5.9", | ||
"version": "0.5.10", | ||
"author": "Marak Squires <marak.squires@gmail.com>", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -38,3 +38,3 @@ if (typeof module !== 'undefined') { | ||
describe("sentence()", function () { | ||
context("when no 'wordCount' param passed in", function () { | ||
context("when no 'wordCount' or 'range' param passed in", function () { | ||
it("returns a string of at least three words", function () { | ||
@@ -70,2 +70,18 @@ sinon.spy(Faker.Lorem, 'words'); | ||
}); | ||
context("when 'wordCount' and 'range' params passed in", function () { | ||
it("returns a string of at least the requested number of words", function () { | ||
sinon.spy(Faker.Lorem, 'words'); | ||
sinon.stub(Faker.random, 'number').returns(4); | ||
var sentence = Faker.Lorem.sentence(10, 4); | ||
assert.ok(typeof sentence === 'string'); | ||
var parts = sentence.split(' '); | ||
assert.equal(parts.length, 14); // requested 10 plus stubbed 4. | ||
assert.ok(Faker.Lorem.words.calledWith(14)); | ||
Faker.Lorem.words.restore(); | ||
Faker.random.number.restore(); | ||
}); | ||
}); | ||
}); | ||
@@ -72,0 +88,0 @@ |
675108
10658