forked from faker-ruby/faker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Faker::StarTrek (faker-ruby#884)
- Loading branch information
Showing
5 changed files
with
62 additions
and
0 deletions.
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,12 @@ | ||
# Faker::StarTrek | ||
|
||
```ruby | ||
Faker::StarTrek.character #=> "Spock" | ||
|
||
Faker::StarTrek.location #=> "Cardassia" | ||
|
||
Faker::StarTrek.specie #=> "Ferengi" | ||
|
||
Faker::StarTrek.villain #=> "Khan Noonien Singh" | ||
|
||
``` |
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 StarTrek < Base | ||
class << self | ||
def character | ||
fetch('star_trek.character') | ||
end | ||
|
||
def location | ||
fetch('star_trek.location') | ||
end | ||
|
||
def specie | ||
fetch('star_trek.specie') | ||
end | ||
|
||
def villain | ||
fetch('star_trek.villain') | ||
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') | ||
|
||
class TestFakerStarTrek < Test::Unit::TestCase | ||
def setup | ||
@tester = Faker::StarTrek | ||
end | ||
|
||
def test_champions | ||
assert @tester.character.match(/\w+/) | ||
end | ||
|
||
def test_locations | ||
assert @tester.location.match(/\w+/) | ||
end | ||
|
||
def test_species | ||
assert @tester.specie.match(/\w+/) | ||
end | ||
|
||
def test_villains | ||
assert @tester.villain.match(/\w+/) | ||
end | ||
end |