diff --git a/test/test_faker_hacker_talk.rb b/test/test_faker_hacker_talk.rb index 4ae7fc133d..362a7211c0 100644 --- a/test/test_faker_hacker_talk.rb +++ b/test/test_faker_hacker_talk.rb @@ -1,37 +1,36 @@ require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb') -class TestFakerHacker < Test::Unit::TestCase +class TestFakerHacker < Test::Unit::TestCase def setup @hacker = Faker::Hacker - @phrases = @hacker.phrases + @phrases = @hacker.phrases end - - def test_phrases - assert @phrases.size == 8 + + def test_phrases + assert @phrases.size == 8 @phrases.each do |phrase| - assert !phrase.nil? - assert phrase != "" - end - end - - def test_noun + refute phrase.to_s.empty? + end + end + + def test_noun assert @hacker.noun.match(/\w+/) end - + def test_abbreviation assert @hacker.abbreviation.match(/\w+/) end - + def test_adjective assert @hacker.adjective.match(/\w+/) end - + def test_verb assert @hacker.verb.match(/\w+/) end - + def test_ingverb assert @hacker.ingverb.match(/\w+/) end - + end diff --git a/test/test_faker_music.rb b/test/test_faker_music.rb index 12ab72d7d6..91fd5d94e8 100644 --- a/test/test_faker_music.rb +++ b/test/test_faker_music.rb @@ -8,15 +8,14 @@ def setup def test_keys assert @tester.keys.size == 7 @tester.keys.each do |key| - assert !key.nil? - assert key != "" + refute key.to_s.empty? end end def test_key_variants assert @tester.key_variants.size == 3 @tester.key_variants.each do |key_variant| - assert !key_variant.nil? + refute key_variant.nil? end end diff --git a/test/test_faker_name.rb b/test/test_faker_name.rb index 8e41f874bd..b79aa3fc3b 100644 --- a/test/test_faker_name.rb +++ b/test/test_faker_name.rb @@ -5,19 +5,19 @@ class TestFakerName < Test::Unit::TestCase def setup @tester = Faker::Name end - + def test_name assert @tester.name.match(/(\w+\.? ?){2,3}/) end - + def test_name_with_middle assert @tester.name_with_middle.match(/(\w+\.? ?){3,4}/) end - + def test_prefix assert @tester.prefix.match(/[A-Z][a-z]+\.?/) end - + def test_suffix assert @tester.suffix.match(/[A-Z][a-z]*\.?/) end @@ -25,8 +25,7 @@ def test_suffix def test_job_titles @job_titles = Faker::Name.job_titles @job_titles.each do |title| - assert !title.nil? - assert title != "" - end + refute title.to_s.empty? + end end end diff --git a/test/test_faker_shakespeare.rb b/test/test_faker_shakespeare.rb index 47a94cce53..b07b0562ce 100644 --- a/test/test_faker_shakespeare.rb +++ b/test/test_faker_shakespeare.rb @@ -1,53 +1,49 @@ require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb') -class TestFakerShakespeare < Test::Unit::TestCase +class TestFakerShakespeare < Test::Unit::TestCase def setup @romeo_and_juliet = Faker::Shakespeare.romeo_and_juliet @king_richard_iii = Faker::Shakespeare.king_richard_iii @as_you_like_it = Faker::Shakespeare.as_you_like_it @hamlet = Faker::Shakespeare.hamlet end - + def test_quotes - assert @romeo_and_juliet.size == 11 - @romeo_and_juliet.each do |quotes| - assert !quotes.nil? - assert quotes != "" - end - - assert @king_richard_iii.size == 8 - @king_richard_iii.each do |quotes| - assert !quotes.nil? - assert quotes != "" - end - - assert @as_you_like_it.size == 8 - @as_you_like_it.each do |quotes| - assert !quotes.nil? - assert quotes != "" - end - - assert @hamlet.size == 18 - @hamlet.each do |quotes| - assert !quotes.nil? - assert quotes != "" - end - end - + assert @romeo_and_juliet.size == 11 + @romeo_and_juliet.each do |quote| + refute quote.to_s.empty? + end + + assert @king_richard_iii.size == 8 + @king_richard_iii.each do |quote| + refute quote.to_s.empty? + end + + assert @as_you_like_it.size == 8 + @as_you_like_it.each do |quote| + refute quote.to_s.empty? + end + + assert @hamlet.size == 18 + @hamlet.each do |quote| + refute quote.to_s.empty? + end + end + def test_as_you_like_it_quote assert Faker::Shakespeare.as_you_like_it_quote.match(/\w+/) end - + def test_king_richard_iii_quote assert Faker::Shakespeare.king_richard_iii_quote.match(/\w+/) end - + def test_romeo_and_juliet_quote assert Faker::Shakespeare.romeo_and_juliet_quote.match(/\w+/) end - + def test_hamlet_quote assert Faker::Shakespeare.hamlet_quote.match(/\w+/) end - + end diff --git a/test/test_faker_star_wars.rb b/test/test_faker_star_wars.rb index d414a7d849..dcb5d64b02 100644 --- a/test/test_faker_star_wars.rb +++ b/test/test_faker_star_wars.rb @@ -14,38 +14,32 @@ def setup def test_strings assert @characters.size == 33 @characters.each do |character| - assert !character.nil? - assert character != "" + refute character.to_s.empty? end assert @droids.size == 21 @droids.each do |droid| - assert !droid.nil? - assert droid != "" + refute droid.to_s.empty? end assert @planets.size == 20 @planets.each do |planet| - assert !planet.nil? - assert planet != "" + refute planet.to_s.empty? end assert @quotes.size == 30 @quotes.each do |quote| - assert !quote.nil? - assert quote != "" + refute quote.to_s.empty? end assert @species.size == 9 @species.each do |specie| - assert !specie.nil? - assert specie != "" + refute specie.to_s.empty? end assert @vehicles.size == 21 @vehicles.each do |vehicle| - assert !vehicle.nil? - assert vehicle != "" + refute vehicle.to_s.empty? end assert @wookie_words.size == 22