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 Faker.Job.En module to generate fake job information in English #572

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format.
## Unreleased

### Added
- `Faker.Job.En` - [[@gabrielmiller](https://github.com/gabrielmiller)]

### Changed

Expand Down
1 change: 1 addition & 0 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
- [Faker.Internet.StatusCode](lib/faker/internet/status_code.ex)
- [Faker.Internet.UserAgent](lib/faker/internet/user_agent.ex)
<!-- J -->
- [Faker.Job.En](lib/faker/job/en.ex)
<!-- K -->
<!-- L -->
- [Faker.Lorem](lib/faker/lorem.ex)
Expand Down
239 changes: 239 additions & 0 deletions lib/faker/job/en.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
defmodule Faker.Job.En do
import Faker, only: [sampler: 2]

@doc """
Returns a random job title

## Examples

iex> Faker.Job.En.title()
"Product Mining Officer"
iex> Faker.Job.En.title()
"Sales Planner"
iex> Faker.Job.En.title()
"Legacy Manufacturing Producer"
iex> Faker.Job.En.title()
"Accounting Consultant"
"""
@spec title() :: String
def title, do: title(Faker.random_between(0, 4))

defp title(0) do
"#{seniority()} #{field()} #{position()}"
end

defp title(1) do
"#{seniority()} #{field()} #{position()}"
end

defp title(2) do
"#{field()} #{position()}"
end

defp title(3) do
"#{field()} #{position()}"
end

defp title(4) do
"#{seniority()} #{position()}"
end

@doc """
Returns a random job position

## Examples

iex> Faker.Job.En.position()
"Administrator"
iex> Faker.Job.En.position()
"Associate"
iex> Faker.Job.En.position()
"Administrator"
iex> Faker.Job.En.position()
"Officer"
"""
@spec position() :: String
sampler(:position, [
"Supervisor",
"Associate",
"Executive",
"Liaison",
"Officer",
"Manager",
"Engineer",
"Specialist",
"Director",
"Coordinator",
"Administrator",
"Architect",
"Analyst",
"Designer",
"Planner",
"Orchestrator",
"Technician",
"Developer",
"Producer",
"Consultant",
"Assistant",
"Facilitator",
"Agent",
"Representative",
"Strategist"
])

@doc """
Returns a random job field

## Examples

iex> Faker.Job.En.field()
"Government"
iex> Faker.Job.En.field()
"Accounting"
iex> Faker.Job.En.field()
"Mining"
iex> Faker.Job.En.field()
"Hospitality"
"""
@spec field() :: String
sampler(:field, [
"Marketing",
"IT",
"Accounting",
"Administration",
"Advertising",
"Banking",
"Community-Services",
"Construction",
"Consulting",
"Design",
"Education",
"Farming",
"Government",
"Healthcare",
"Hospitality",
"Legal",
"Manufacturing",
"Marketing",
"Mining",
"Real-Estate",
"Retail",
"Sales",
"Technology"
])

@doc """
Returns a random job key skill

## Examples

iex> Faker.Job.En.key_skill()
"Confidence"
iex> Faker.Job.En.key_skill()
"Work under pressure"
iex> Faker.Job.En.key_skill()
"Leadership"
iex> Faker.Job.En.key_skill()
"Networking skills"
"""
@spec key_skill() :: String
sampler(:key_skill, [
"Teamwork",
"Communication",
"Problem solving",
"Leadership",
"Organisation",
"Work under pressure",
"Confidence",
"Self-motivated",
"Networking skills",
"Proactive",
"Fast learner",
"Technical savvy"
])

@doc """
Returns a random job seniority

## Examples

iex> Faker.Job.En.seniority()
"Central"
iex> Faker.Job.En.seniority()
"Product"
iex> Faker.Job.En.seniority()
"Lead"
iex> Faker.Job.En.seniority()
"District"
"""
@spec seniority() :: String
sampler(:seniority, [
"Lead",
"Senior",
"Product",
"National",
"Regional",
"District",
"Central",
"Global",
"Customer",
"Investor",
"Dynamic",
"International",
"Legacy",
"Forward",
"Internal",
"Chief",
"Direct",
"Corporate",
"Future",
"Human",
"Principal"
])

@doc """
Returns a random job employment type

## Examples

iex> Faker.Job.En.employment_type()
"Full-time"
iex> Faker.Job.En.employment_type()
"Commission"
iex> Faker.Job.En.employment_type()
"Contract"
iex> Faker.Job.En.employment_type()
"Temporary"
"""
@spec employment_type() :: String
sampler(:employment_type, [
"Full-time",
"Part-time",
"Temporary",
"Contract",
"Internship",
"Commission"
])

@doc """
Returns a random job education level

## Examples

iex> Faker.Job.En.education_level()
"Master"
iex> Faker.Job.En.education_level()
"Bachelor"
iex> Faker.Job.En.education_level()
"Doctorate"
iex> Faker.Job.En.education_level()
"Associates"
"""
@spec education_level() :: String
sampler(:education_level, [
"Associates",
"Bachelor",
"Master",
"Doctorate"
])
end
2 changes: 1 addition & 1 deletion test/faker/fruit_test.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Faker.FuitTest do
defmodule Faker.FruitTest do
use ExUnit.Case, async: true

doctest Faker.Fruit.PtBr
Expand Down
5 changes: 5 additions & 0 deletions test/faker/job_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defmodule Faker.JobTest do
use ExUnit.Case, async: true

doctest Faker.Job.En
end