Skip to content

Commit

Permalink
Missing i18n jobs fix (faker-ruby#1142)
Browse files Browse the repository at this point in the history
* update rake

* add failing test for locale without translations

* add fetch for position fixing faker-ruby#1139

* reformat class to make consistant with other Faker classes
  • Loading branch information
PuZZleDucK authored and vbrazo committed May 17, 2018
1 parent aaad5ca commit 050b87e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/faker/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ def title
parse('job.title')
end

def position
fetch('job.position')
end

def field
fetch('job.field')
end
Expand Down
4 changes: 4 additions & 0 deletions test/test_faker_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ def test_field
def test_key_skill
assert @tester.key_skill.match(/(\w+\.? ?)/)
end

def test_position
assert @tester.position.match(/(\w+\.? ?)/)
end
end
16 changes: 16 additions & 0 deletions test/test_faker_job_locale.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')

class TestFakerJobLocale < Test::Unit::TestCase
def setup
Faker::Config.locale = 'en-AU'
@tester = Faker::Job
end

def teardown
Faker::Config.locale = nil
end

def test_locale_without_jobs_defaults_to_en
assert @tester.position.match(/(\w+\.? ?)/)
end
end

0 comments on commit 050b87e

Please sign in to comment.