Sha256: b7392286af5af46bc0fce605c029f8d91afaa8814a96b20bf4fd9b3f23ca3f03

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require_relative 'helper'

class TestLoremIE < Test::Unit::TestCase
  include DeterministicHelper

  assert_methods_are_deterministic(
    FFaker::LoremIE,
    :paragraph, :paragraphs, :sentence, :sentences,
    :phrase, :phrases, :word, :words, :question
  )

  WORDS_REGEX = /\A[\w\W]+\z/i # spaces, alphanumeric & perioids, etc.
  WORD_REGEX = /\A[áéíóúa-z]+\z/i

  def test_paragraph
    assert_match(WORDS_REGEX, FFaker::LoremIE.paragraph)
  end

  def test_question
    assert_match(WORDS_REGEX, FFaker::LoremIE.question)
  end

  def test_sentence
    assert_match(WORDS_REGEX, FFaker::LoremIE.sentence)
  end

  def test_phrase
    assert_match(WORDS_REGEX, FFaker::LoremIE.phrase)
  end

  def test_paragraphs
    assert_match(WORDS_REGEX, FFaker::LoremIE.paragraphs.join(' '))
  end

  def test_sentences
    assert_match(WORDS_REGEX, FFaker::LoremIE.sentences.join(' '))
  end

  def test_phrases
    assert_match(WORDS_REGEX, FFaker::LoremIE.phrases.join(' '))
  end

  def test_words
    assert_match(WORDS_REGEX, FFaker::LoremIE.words.join(' '))
  end

  def test_word
    assert_match(WORD_REGEX, FFaker::LoremIE.word)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ffaker-2.23.0 test/test_lorem_ie.rb
ffaker-2.22.0 test/test_lorem_ie.rb