diff --git a/lib/faker/star_wars.rb b/lib/faker/star_wars.rb index 50cef881a2..304a7e8615 100644 --- a/lib/faker/star_wars.rb +++ b/lib/faker/star_wars.rb @@ -17,8 +17,8 @@ def quote quotes.sample end - def specie - species.sample + def species + species_list.sample end def vehicle @@ -62,7 +62,7 @@ def quotes "Fear is the path to the dark side... fear leads to anger... anger leads to hate... hate leads to suffering.", "Do. Or do not. There is no try."] end - def species + def species_list ['Ewok', 'Hutt', 'Gungan', 'Ithorian', 'Jawa', 'Neimoidian', 'Sullustan', 'Wookiee', 'Mon Calamari'] end @@ -75,6 +75,11 @@ def wookie_words ['wyaaaaaa', 'ruh', 'huewaa', 'muaa', 'mumwa', 'wua', 'ga', 'ma', 'ahuma', 'ooma', 'youw', 'kabukk', 'wyogg', 'gwyaaaag', 'roooarrgh', 'ur', 'ru', 'roo', 'hnn-rowr', 'yrroonn', 'nng', 'rarr'] end + + def specie + puts "#{self}.#{__method__} is deprecated and will be removed. Switch to the functionally identical #{self}.species at your convenience." unless caller[0].to_s.include? "test" + species + end end end end diff --git a/test/test_faker_star_wars.rb b/test/test_faker_star_wars.rb index dcb5d64b02..216b5c6f6d 100644 --- a/test/test_faker_star_wars.rb +++ b/test/test_faker_star_wars.rb @@ -6,7 +6,7 @@ def setup @droids = Faker::StarWars.droids @planets = Faker::StarWars.planets @quotes = Faker::StarWars.quotes - @species = Faker::StarWars.species + @species = Faker::StarWars.species_list @vehicles = Faker::StarWars.vehicles @wookie_words = Faker::StarWars.wookie_words end @@ -65,8 +65,8 @@ def test_quote assert Faker::StarWars.quote.match(/\w+/) end - def test_specie - assert Faker::StarWars.specie.match(/\w+/) + def test_species + assert Faker::StarWars.species.match(/\w+/) end def test_vehicle @@ -76,4 +76,8 @@ def test_vehicle def test_wookie_sentence assert Faker::StarWars.wookie_sentence.match(/\w+/) end + + def test_specie # Ensure StarWars.specie calls continue to work. To be removed when StarWars.specie is removed. + assert Faker::StarWars.specie.match(/\w+/) + end end