Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/faker/star_wars.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def quote
quotes.sample
end

def specie
species.sample
def species
species_list.sample
end

def vehicle
Expand Down Expand Up @@ -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

Expand All @@ -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
10 changes: 7 additions & 3 deletions test/test_faker_star_wars.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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