Skip to content

Commit

Permalink
Add keyword argument to Faker::Games::Dota.quote (#1434)
Browse files Browse the repository at this point in the history
* Add keyword argument to Faker::Games::Dota.quote

* Add missing Dota.quote test

* Update dota.md
  • Loading branch information
vbrazo authored Oct 23, 2018
1 parent a66f07a commit 42a51f9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion doc/dota.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Faker::Games::Dota.team #=> "Evil Geniuses"
Faker::Games::Dota.player #=> "Dendi"

# Random quote
# by default if you don't pass the hero parameter, the quote method will set hero as 'abbadon'
Faker::Games::Dota.quote #=> "Easy now, this stuff is explosive!"
Faker::Games::Dota.quote(hero = 'alchemist') #=> "Better living through alchemy!"
Faker::Games::Dota.quote(hero: 'alchemist') #=> "Better living through alchemy!"
```
2 changes: 1 addition & 1 deletion lib/faker/dota.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def player
end

def quote(hero = 'abaddon')
Faker::Games::Dota.quote(hero)
Faker::Games::Dota.quote(hero: hero)
end

deprecate :hero, 'Faker::Games::Dota.hero', 2018, 10
Expand Down
2 changes: 1 addition & 1 deletion lib/faker/games/dota.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def player
fetch('games.dota.player')
end

def quote(hero = 'abaddon')
def quote(hero: 'abaddon')
fetch("games.dota.#{hero}.quote")
end
end
Expand Down
4 changes: 4 additions & 0 deletions test/test_deprecate_dota.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def test_player
assert @tester.player.match(/\w+/)
end

def test_quotes
assert @tester.quote.match(/\w+/)
end

def test_heroes_quotes
@heroes.each do |hero|
assert_match(/\w+/, @tester.quote(hero))
Expand Down
2 changes: 1 addition & 1 deletion test/test_faker_dota.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_player

def test_heroes_quotes
@heroes.each do |hero|
assert_match(/\w+/, @tester.quote(hero))
assert_match(/\w+/, @tester.quote(hero: hero))
end
end
end

0 comments on commit 42a51f9

Please sign in to comment.