Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keyword argument to Faker::Games::Dota.quote #1434

Merged
merged 3 commits into from
Oct 23, 2018
Merged
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
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!"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a mention that the default hero arg is abbadon?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely. Thanks :)

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
1 change: 1 addition & 0 deletions test/test_faker_phone_number.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true

require_relative 'test_helper'

Expand Down