Sha256: e8642a8e8826017cdf443e73c52b5a5404906777c802150b815cb4d1a76b528a

Contents?: true

Size: 870 Bytes

Versions: 5

Compression:

Stored size: 870 Bytes

Contents

require 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

5 entries across 5 versions & 1 rubygems

Version Path
faker19-1.0.5 test/test_faker_lorem.rb
faker19-1.0.4 test/test_faker_lorem.rb
faker19-1.0.3 test/test_faker_lorem.rb
faker19-1.0.2 test/test_faker_lorem.rb
faker19-1.0.1 test/test_faker_lorem.rb