Skip to content

Instantly share code, notes, and snippets.

@jaredbeck
Last active January 7, 2022 04:38
Show Gist options
  • Select an option

  • Save jaredbeck/8e65388a1389c989b5594195a7dfe66a to your computer and use it in GitHub Desktop.

Select an option

Save jaredbeck/8e65388a1389c989b5594195a7dfe66a to your computer and use it in GitHub Desktop.
require 'active_support/all'
require 'minitest/autorun'
module CodeInflector
extend ActiveSupport::Inflector
def inflections
i = ActiveSupport::Inflector::Inflections.new
i.acronym 'SSN'
end
end
class MyTest < Minitest::Test
def test_camelize
{
'create_wombats' => 'CreateWombats', # passes
'create_ssns' => 'CreateSSNs' # fails with "CreateSsns"
}.each do |k, v|
assert_equal v, CodeInflector.camelize(k)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment