Sha256: 3140309992535f04340b138844c0e8162c4449e16dac9095dbc3413d8148fc07

Contents?: true

Size: 670 Bytes

Versions: 1

Compression:

Stored size: 670 Bytes

Contents

require 'helper'

class TestBabynames < Test::Unit::TestCase
  should "return a random name" do
    name = BabyNames.name
    assert name.size > 0
    assert name.is_a? String
  end
  
  should "return an array of names" do
    [:names, :female_names, :male_names].each do |method|
      names = BabyNames.send(method)
      assert names.size > 500
      assert names.collect{|n| n.size > 0 && n.is_a?(String)}
    end
  end
  
  should "seed the sequence" do
    seed = BabyNames.seed
    names = []
    1.upto(3).each do
      names << BabyNames.name
    end
    
    BabyNames.seed(seed)
    names.each do |name|
      assert BabyNames.name == name
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
babynames-0.0.1 test/test_babynames.rb