Skip to content

Commit

Permalink
Random words to add should be 0 (#719)
Browse files Browse the repository at this point in the history
* Random words to add should be 0

Gives very unexpected results, especially weird when validating max char length of a field

* Merge with master and minor changes

* Update changelog

* Minor fix
  • Loading branch information
swapsCAPS authored and vbrazo committed Jun 11, 2018
1 parent b36b2f4 commit b1d6bd0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
### Latest update: 2018-06-09

### Feature Request
- [PR #817](https://github.com/stympy/faker/pull/817) Faker::Lorem.multibyte for multibyte chars [@frankywahl](https://github.com/frankywahl)
- [PR #877](https://github.com/stympy/faker/pull/877) Add Canada SIN generator in Faker::Code [@gkunwar](https://github.com/gkunwar)
- [PR #1268](https://github.com/stympy/faker/pull/1268) Add Faker::Nation.national_sport [@gkunwar](https://github.com/gkunwar)
- [PR #1273](https://github.com/stympy/faker/pull/1273) Add Faker::Device [@vbrazo](https://github.com/vbrazo)
Expand Down Expand Up @@ -92,6 +93,9 @@
- [PR #1172](https://github.com/stympy/faker/pull/1172) Fix Fixnum reference warning [@vbrazo](https://github.com/vbrazo)
- [PR #1173](https://github.com/stympy/faker/pull/1173) Fix tests warning [@vbrazo](https://github.com/vbrazo)

### Chores
- [PR #719](https://github.com/stympy/faker/pull/719) Random words to add should be 0 [@swapsCAPS](https://github.com/swapsCAPS)

### Documentation
- [PR #1121](https://github.com/stympy/faker/pull/1121) Better docs for Faker::Food.description [@jujulisan](https://github.com/jujulisan)
- [PR #1257](https://github.com/stympy/faker/pull/1257) Fix method name in Faker::SingularSiegler [@mrstebo](https://github.com/mrstebo)
Expand Down
8 changes: 4 additions & 4 deletions lib/faker/lorem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ def multibyte
sample('faker.multibyte')
end

def sentence(word_count = 4, supplemental = false, random_words_to_add = 6)
def sentence(word_count = 4, supplemental = false, random_words_to_add = 0)
words(word_count + rand(random_words_to_add.to_i), supplemental).join(' ').capitalize + locale_period
end

def sentences(sentence_count = 3, supplemental = false)
1.upto(resolve(sentence_count)).collect { sentence(3, supplemental) }
end

def paragraph(sentence_count = 3, supplemental = false, random_sentences_to_add = 3)
def paragraph(sentence_count = 3, supplemental = false, random_sentences_to_add = 0)
sentences(resolve(sentence_count) + rand(random_sentences_to_add.to_i), supplemental).join(locale_space)
end

Expand All @@ -56,8 +56,8 @@ def paragraph_by_chars(chars = 256, supplemental = false)
paragraph[0...chars - 1] + '.'
end

def question(word_count = 4, supplemental = false, random_words_to_add = 6)
words(word_count + rand(random_words_to_add.to_i), supplemental).join(locale_space).capitalize + locale_question_mark
def question(word_count = 4, supplemental = false, random_words_to_add = 0)
words(word_count + rand(random_words_to_add), supplemental).join(' ').capitalize + locale_question_mark
end

def questions(question_count = 3, supplemental = false)
Expand Down

0 comments on commit b1d6bd0

Please sign in to comment.