Sha256: 4e524bab938449a4c267cdf7e05845109f4970d872f43ba08fc6cfdafe2b669b

Contents?: true

Size: 1.94 KB

Versions: 10

Compression:

Stored size: 1.94 KB

Contents

# encoding: utf-8

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

10 entries across 10 versions & 1 rubygems

Version Path
ffaker-2.11.0 test/test_name_gr.rb
ffaker-2.10.0 test/test_name_gr.rb
ffaker-2.9.0 test/test_name_gr.rb
ffaker-2.8.1 test/test_name_gr.rb
ffaker-2.8.0 test/test_name_gr.rb
ffaker-2.7.0 test/test_name_gr.rb
ffaker-2.6.0 test/test_name_gr.rb
ffaker-2.5.0 test/test_name_gr.rb
ffaker-2.4.0 test/test_name_gr.rb
ffaker-2.3.0 test/test_name_gr.rb