diff --git a/CHANGELOG.md b/CHANGELOG.md index b6df36843..3fe4da388 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/USAGE.md b/USAGE.md index a323a03c6..98dcc8850 100644 --- a/USAGE.md +++ b/USAGE.md @@ -74,6 +74,7 @@ - [Faker.Internet.StatusCode](lib/faker/internet/status_code.ex) - [Faker.Internet.UserAgent](lib/faker/internet/user_agent.ex) +- [Faker.Job.En](lib/faker/job/en.ex) - [Faker.Lorem](lib/faker/lorem.ex) diff --git a/lib/faker/job/en.ex b/lib/faker/job/en.ex new file mode 100644 index 000000000..911ef66e2 --- /dev/null +++ b/lib/faker/job/en.ex @@ -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 diff --git a/test/faker/fruit_test.exs b/test/faker/fruit_test.exs index 59e9f03dc..17dc99316 100644 --- a/test/faker/fruit_test.exs +++ b/test/faker/fruit_test.exs @@ -1,4 +1,4 @@ -defmodule Faker.FuitTest do +defmodule Faker.FruitTest do use ExUnit.Case, async: true doctest Faker.Fruit.PtBr diff --git a/test/faker/job_test.exs b/test/faker/job_test.exs new file mode 100644 index 000000000..756392038 --- /dev/null +++ b/test/faker/job_test.exs @@ -0,0 +1,5 @@ +defmodule Faker.JobTest do + use ExUnit.Case, async: true + + doctest Faker.Job.En +end