Sha256: 58a2b4dfe6b770cfba3286cf98c8b85c8a00dc1619d49309bd21f26d863cc541

Contents?: true

Size: 1.35 KB

Versions: 10

Compression:

Stored size: 1.35 KB

Contents

# encoding: utf-8

require 'helper'

# Author: PapePathe<pathe.sene@gmail.com> github.com/PapePathe
class TestFakerNameFR < Test::Unit::TestCase
  include DeterministicHelper

  assert_methods_are_deterministic(
    FFaker::NameFR,
    :first_name, :last_name, :prefix
  )

  def setup
    @tester = FFaker::NameFR
  end

  def test_last_name
    assert_include @tester::LAST_NAMES, @tester.last_name
  end

  def test_first_name
    assert_include @tester::FIRST_NAMES, @tester.first_name
  end

  def test_prefix
    assert_include @tester::PREFIX, @tester.prefix
  end

  def test_name
    # => split the name into an array of words
    parts = @tester.name.split(' ')
    case parts.count
    when 3
      first_name, prefix, last_name = parts
      # the value at the index 1 should be a valid! prefix
      assert_include @tester::PREFIX, prefix

      # the value at the index 0 should be a valid! first_name
      assert_include @tester::FIRST_NAMES, first_name

      # the value at the index 2 should be a valid! last_name
      assert_include @tester::LAST_NAMES, last_name
    when 2
      first_name, last_name = parts
      # the value at the index 0 should be a valid! first_name
      assert_include @tester::FIRST_NAMES, first_name

      # the value at the index 1 should be a valid! last_name
      assert_include @tester::LAST_NAMES, last_name
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ffaker-2.11.0 test/test_name_fr.rb
ffaker-2.10.0 test/test_name_fr.rb
ffaker-2.9.0 test/test_name_fr.rb
ffaker-2.8.1 test/test_name_fr.rb
ffaker-2.8.0 test/test_name_fr.rb
ffaker-2.7.0 test/test_name_fr.rb
ffaker-2.6.0 test/test_name_fr.rb
ffaker-2.5.0 test/test_name_fr.rb
ffaker-2.4.0 test/test_name_fr.rb
ffaker-2.3.0 test/test_name_fr.rb