From 5446693f9a54aa1dd9d8064d86945692b5008755 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Fri, 5 Feb 2021 05:52:02 -0800 Subject: [PATCH] Add Faker::Educator.primary_school Generates a primary school name. For example: "Brighthurst Elementary School" --- doc/default/educator.md | 2 ++ lib/faker/default/educator.rb | 13 +++++++++++++ lib/locales/en/educator.yml | 6 ++++++ test/faker/default/test_faker_educator.rb | 4 ++++ 4 files changed, 25 insertions(+) diff --git a/doc/default/educator.md b/doc/default/educator.md index 6c8d18f9ac..023f0f048f 100644 --- a/doc/default/educator.md +++ b/doc/default/educator.md @@ -7,6 +7,8 @@ Faker::Educator.university #=> "Mallowtown Technical College" Faker::Educator.secondary_school #=> "Iceborough Secondary College" +Faker::Educator.primary_school #=> "Brighthurst Elementary School" + Faker::Educator.degree #=> "Associate Degree in Criminology" Faker::Educator.course_name #=> "Criminology 101" diff --git a/lib/faker/default/educator.rb b/lib/faker/default/educator.rb index 9e00d255aa..33cfb95b45 100644 --- a/lib/faker/default/educator.rb +++ b/lib/faker/default/educator.rb @@ -72,6 +72,19 @@ def secondary_school parse('educator.secondary_school') end + ## + # Produces a primary school. + # + # @return [String] + # + # @example + # Faker::Educator.primary_school #=> "Brighthurst Elementary School" + # + # @faker.version next + def primary_school + parse('educator.primary_school') + end + ## # Produces a campus name. # diff --git a/lib/locales/en/educator.yml b/lib/locales/en/educator.yml index da9951e4d9..f58c3ccecc 100644 --- a/lib/locales/en/educator.yml +++ b/lib/locales/en/educator.yml @@ -22,10 +22,16 @@ en: - High - High School - Secondary College + primary: + - Elementary School + - Grade School + - Primary School university: - "#{Educator.school_name} #{Educator.tertiary.university_type}" secondary_school: - "#{Educator.school_name} #{secondary}" + primary_school: + - "#{school_name} #{primary}" campus: - "#{Educator.school_name} Campus" subject: diff --git a/test/faker/default/test_faker_educator.rb b/test/faker/default/test_faker_educator.rb index e1ec0de689..01901c3381 100644 --- a/test/faker/default/test_faker_educator.rb +++ b/test/faker/default/test_faker_educator.rb @@ -27,6 +27,10 @@ def test_secondary_school assert @tester.secondary_school.match(/(\w+\.? ?){2,3}/) end + def test_primary_school + assert @tester.primary_school.match(/(\w+\.? ?){2,3}/) + end + def test_campus assert @tester.campus.match(/(\w+\.? ?){1,2}/) end