Skip to content

Commit

Permalink
Refactored code
Browse files Browse the repository at this point in the history
  • Loading branch information
sudeeptarlekar committed Jul 30, 2020
1 parent ee2dc2d commit 8b8b3e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/faker/default/driving_licence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def uk_driving_licence(*args)
end

def usa_driving_licence(state = 'CA')
bothify(fetch("driving_licence.usa_state_formats.#{state.upcase}"))
bothify(fetch("driving_licence.usa_state_formats.#{state.to_s.upcase}"))
rescue I18n::MissingTranslationData => _e
raise InvalidStatePassed, "Invalid state code passed for USA, '#{state}'"
end
Expand Down
6 changes: 5 additions & 1 deletion test/faker/default/test_faker_driving_licence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ def test_usa_driving_licence_for_different_states

def test_usa_driving_licence_with_faker_code
assert_raises(Faker::InvalidStatePassed) do
@tester.usa_driving_licence('123')
@tester.usa_driving_licence('abc')
end

assert_raises(Faker::InvalidStatePassed) do
@tester.usa_driving_licence(123)
end
end
end

0 comments on commit 8b8b3e7

Please sign in to comment.