-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hobbit characters, locations, & quotes (#889)
- Loading branch information
Showing
5 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Faker::Hobbit | ||
|
||
```ruby | ||
# Any character from the book | ||
Faker::Hobbit.character #=> "Gandalf the Grey" | ||
|
||
# One of the 13 dwarves from the Company, or Gandalf, or Bilbo | ||
Faker::Hobbit.thorins_company #=> "Thorin Oakenshield" | ||
|
||
Faker::Hobbit.quote #=> "Never laugh at live dragons, Bilbo you fool!" | ||
|
||
Faker::Hobbit.location #=> "The Shire" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module Faker | ||
class Hobbit < Base | ||
class << self | ||
def character | ||
fetch('hobbit.character') | ||
end | ||
|
||
def thorins_company | ||
fetch('hobbit.thorins_company') | ||
end | ||
|
||
def quote | ||
fetch('hobbit.quote') | ||
end | ||
|
||
def location | ||
fetch('hobbit.location') | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb') | ||
|
||
class TestFakerHobbit < Test::Unit::TestCase | ||
def setup | ||
@tester = Faker::Hobbit | ||
end | ||
|
||
def test_character | ||
assert @tester.character.match(/\w+/) | ||
end | ||
|
||
def test_quote | ||
assert @tester.quote.match(/\w+/) | ||
end | ||
|
||
def test_location | ||
assert @tester.location.match(/\w+/) | ||
end | ||
|
||
def test_thorins_company | ||
assert @tester.thorins_company.match(/\w+/) | ||
end | ||
end |