Sha256: 8a434b8a2f75c2e022ad2d325526b1591435b26ad301d68d6d35ef32b20e2823

Contents?: true

Size: 1.3 KB

Versions: 7

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

require 'helper'

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

7 entries across 7 versions & 1 rubygems

Version Path
ffaker-2.18.0 test/test_name_fr.rb
ffaker-2.17.0 test/test_name_fr.rb
ffaker-2.16.0 test/test_name_fr.rb
ffaker-2.15.0 test/test_name_fr.rb
ffaker-2.14.0 test/test_name_fr.rb
ffaker-2.13.0 test/test_name_fr.rb
ffaker-2.12.0 test/test_name_fr.rb