Sha256: 8efdaded4bd1f37d8a6cf965f7a96f6be66b0452f9b3ab727cf3e52fa21a2ca8
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true require_relative 'helper' class TestFakerNameJA < Test::Unit::TestCase class << self def startup FFakerTW::NameJA.const_set(:FIRST_NAMES, %w[あきら フミ 三郎]) FFakerTW::NameJA.const_set(:LAST_NAMES, %w[佐藤 高橋 佐々木]) end def shutdown FFakerTW::NameJA.class_eval { remove_const(:FIRST_NAMES) } FFakerTW::NameJA.class_eval { remove_const(:LAST_NAMES) } end end include DeterministicHelper assert_methods_are_deterministic( FFakerTW::NameJA, :last_name, :first_name, :last_first, :name ) def setup @tester = FFakerTW::NameJA end def test_first_name assert_include(@tester::FIRST_NAMES, @tester.first_name) end def test_last_name assert_include(@tester::LAST_NAMES, @tester.last_name) end def test_last_first assert_last_first(@tester.last_first) end def test_name assert_last_first(@tester.name) end private def assert_last_first(actual) last_first_regexp = /(#{@tester::LAST_NAMES.join('|')})(#{@tester::FIRST_NAMES.join('|')})/ assert_match(last_first_regexp, actual) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ffakerTW-0.1.0 | test/test_name_ja.rb |