File: test_name_ph.rb

package info (click to toggle)
ruby-ffaker 2.25.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,852 kB
  • sloc: ruby: 13,136; makefile: 8; sh: 1
file content (34 lines) | stat: -rw-r--r-- 633 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# frozen_string_literal: true

require_relative 'helper'

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

  PH_REGEXP = /\A([\wñÑú-]+\.? ?){2,5}\z/

  assert_methods_are_deterministic(
    FFaker::NamePH,
    :name, :last_name, :first_name, :prefix
  )

  def setup
    @tester = FFaker::NamePH
  end

  def test_name
    assert_match(PH_REGEXP, @tester.name)
  end

  def test_last_name
    assert_match(PH_REGEXP, @tester.last_name)
  end

  def test_first_name
    assert_match(PH_REGEXP, @tester.first_name)
  end

  def test_prefix
    assert_match(/\A[A-Z][a-z]+\.?\z/, @tester.prefix)
  end
end