Sha256: af646f6e0788ec70b34ba0a5c43e889669e0ef74d75c1f5b8031496a6844adcc

Contents?: true

Size: 887 Bytes

Versions: 1

Compression:

Stored size: 887 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')

class TestFakerLorem < Test::Unit::TestCase

  def setup
    @tester = Faker::Lorem
    @standard_wordlist = I18n.translate('faker.lorem.words')
    @complete_wordlist = 
      @standard_wordlist + I18n.translate('faker.lorem.supplemental')
  end
  
  # Words delivered by a standard request should be on the standard wordlist.
  def test_standard_words
    @words = @tester.words(1000)
    @words.each {|w| assert @standard_wordlist.include?(w) }
  end

  # Words requested from the supplemental list should all be in that list.
  def test_supplemental_words
    @words = @tester.words(10000, true)
    @words.each {|w| assert @complete_wordlist.include?(w) }
  end

  def test_argument_as_range
    1.upto(4) do
      assert @tester.words(3..5).size >= 3
      assert @tester.words(3..5).size <= 5
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
faker19-1.0.0 test/test_faker_lorem.rb