Sha256: 1e960cccb01972bd2e743825f9a71a2f71a9ae287fab9f94c4f53261e0e60d89

Contents?: true

Size: 1.21 KB

Versions: 10

Compression:

Stored size: 1.21 KB

Contents

# encoding: utf-8

require 'helper'

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

  def setup
    @tester = Faker::NameIT
  end

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

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

  def test_prefix
    assert Faker::NameIT::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 0 should be a valid! prefix
      assert Faker::NameIT::PREFIX.include?(parts[0])

      # the value at the index 1 should be a valid! first_name
      assert Faker::NameIT::FIRST_NAMES.include?(parts[1])

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

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

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

end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/ffaker-1.32.1/test/test_name_it.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/ffaker-1.32.1/test/test_name_it.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/ffaker-1.32.1/test/test_name_it.rb
ffaker-1.32.1 test/test_name_it.rb
ffaker-1.32.0 test/test_name_it.rb
ffaker-1.31.0 test/test_name_it.rb
ffaker-1.30.0 test/test_name_it.rb
ffaker-1.25.0 test/test_name_it.rb
ffaker-1.24.0 test/test_name_it.rb
ffaker-1.23.0 test/test_name_it.rb