Sha256: ef2cdde06150d0f16db59bba2ee3faa0a08d5bedd9ae2f89ecb01adadc07aeb8

Contents?: true

Size: 1.95 KB

Versions: 7

Compression:

Stored size: 1.95 KB

Contents

# frozen_string_literal: true

require 'helper'

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

  assert_methods_are_deterministic(
    FFaker::NameGR,
    :male_first_name, :male_last_name, :female_first_name, :female_last_name,
    :male_full_name, :female_full_name, :last_name, :first_name
  )

  def setup
    @tester = FFaker::NameGR
  end

  def test_male_first_name
    assert_include @tester::MALE_FIRST_NAMES, @tester.male_first_name
  end

  def test_male_last_name
    assert_include @tester::MALE_LAST_NAMES, @tester.male_last_name
  end

  def test_female_first_name
    assert_include @tester::FEMALE_FIRST_NAMES, @tester.female_first_name
  end

  def test_female_last_name
    assert_include @tester::FEMALE_LAST_NAMES, @tester.female_last_name
  end

  def test_male_full_name
    names = @tester.male_full_name.split(' ')
    assert_include @tester::MALE_FIRST_NAMES, names[0]
    assert_include @tester::MALE_LAST_NAMES, names[1]
  end

  def test_female_full_name
    names = @tester.female_full_name.split(' ')
    assert_include @tester::FEMALE_FIRST_NAMES, names[0]
    assert_include @tester::FEMALE_LAST_NAMES, names[1]
  end

  # For random names
  def test_last_name
    all_names = @tester::MALE_LAST_NAMES + @tester::FEMALE_LAST_NAMES
    assert_include all_names, @tester.last_name
  end

  def test_first_name
    all_names = @tester::MALE_FIRST_NAMES + @tester::FEMALE_FIRST_NAMES
    assert_include all_names, @tester.first_name
  end

  def test_full_name_male
    names = @tester.full_name(:male).split(' ')
    assert_include @tester::MALE_FIRST_NAMES, names[0]
    assert_include @tester::MALE_LAST_NAMES, names[1]
    assert_deterministic { @tester.full_name(:male) }
  end

  def test_full_name_female
    names = @tester.full_name(:female).split(' ')
    assert_include @tester::FEMALE_FIRST_NAMES, names[0]
    assert_include @tester::FEMALE_LAST_NAMES, names[1]
    assert_deterministic { @tester.full_name(:female) }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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