Sha256: 245db87b4b9ea9f4ab6347e71f304ae5e0aa5fe141d43c589aec572935b37107

Contents?: true

Size: 1.21 KB

Versions: 14

Compression:

Stored size: 1.21 KB

Contents

# encoding: utf-8

require 'helper'

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

  def setup
    @tester = Faker::NameFR
  end

  def test_last_name
    assert Faker::NameFR::LAST_NAMES.include?(@tester.last_name)
  end

  def test_first_name
    assert Faker::NameFR::FIRST_NAMES.include?(@tester.first_name)
  end

  def test_prefix
    assert Faker::NameFR::PREFIX.include?(@tester.prefix)
  end


  def test_name
    # => split the name into an array of words
    parts = @tester.name.split(' ')

    if parts.count == 3
      # the value at the index 1 should be a valid! prefix
      assert Faker::NameFR::PREFIX.include?(parts[1])

      # the value at the index 0 should be a valid! male_first_name
      assert Faker::NameFR::FIRST_NAMES.include?(parts[0])

      # the value at the index 2 should be a valid! last_name
      assert Faker::NameFR::LAST_NAMES.include?(parts[2])

    elsif parts.count == 2
      # the value at the index 0 should be a valid! prefix
      assert Faker::NameFR::FIRST_NAMES.include?(parts[0])

      # the value at the index 1 should be a valid! last_name
      assert Faker::NameFR::LAST_NAMES.include?(parts[1])
    end
  end

end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/ffaker-1.32.1/test/test_name_fr.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/ffaker-1.32.1/test/test_name_fr.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/ffaker-1.32.1/test/test_name_fr.rb
ffaker-1.32.1 test/test_name_fr.rb
ffaker-1.32.0 test/test_name_fr.rb
ffaker-1.31.0 test/test_name_fr.rb
ffaker-1.30.0 test/test_name_fr.rb
ffaker-1.25.0 test/test_name_fr.rb
ffaker-1.24.0 test/test_name_fr.rb
ffakerer-1.0.2 test/test_faker_name_fr.rb
ffaker-1.23.0 test/test_name_fr.rb
ffakerer-1.0.1 test/test_faker_name_fr.rb
ffaker-1.22.1 test/test_faker_name_fr.rb
ffaker-1.22.0 test/test_faker_name_fr.rb