aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarak <[email protected]>2014-09-09 20:31:15 +0200
committerMarak <[email protected]>2014-09-09 20:31:15 +0200
commitf4c05f8fbb9802e1ff0859fa5fdc19d0e6b70239 (patch)
tree19d35550da90deb339fd470947d87a09c755c51f
parentfd95d87121efbd7aa2098ffa1b414c966c94b01b (diff)
downloadfaker-f4c05f8fbb9802e1ff0859fa5fdc19d0e6b70239.tar.xz
faker-f4c05f8fbb9802e1ff0859fa5fdc19d0e6b70239.zip
Fix random number
-rw-r--r--lib/random.js2
-rw-r--r--test/lorem.unit.js4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/random.js b/lib/random.js
index 78ef2383..7e8cca37 100644
--- a/lib/random.js
+++ b/lib/random.js
@@ -98,7 +98,7 @@ var random = {
},
phone_codes: function () {
- return faker.array_element(definitions.phone_codes);
+ return faker.random.array_element(definitions.phone_codes);
},
domain_suffix: function () {
return faker.random.array_element(definitions.domain_suffix);
diff --git a/test/lorem.unit.js b/test/lorem.unit.js
index f1b174d9..3d50679d 100644
--- a/test/lorem.unit.js
+++ b/test/lorem.unit.js
@@ -54,7 +54,7 @@ describe("lorem.js", function () {
context("when 'wordCount' param 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(2);
+ sinon.stub(faker.random, 'number').withArgs(7).returns(2);
var sentence = faker.Lorem.sentence(10);
assert.ok(typeof sentence === 'string');
@@ -70,7 +70,7 @@ describe("lorem.js", function () {
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').returnsArg(0); // it echos back its maximum possible value.
+ sinon.stub(faker.random, 'number').withArgs(4).returns(4);
var sentence = faker.Lorem.sentence(10, 4);