Last active
January 7, 2022 04:38
-
-
Save jaredbeck/8e65388a1389c989b5594195a7dfe66a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_support/all' | |
require 'minitest/autorun' | |
require 'zeitwerk' | |
class ASITest < Minitest::Test | |
module CodeInflector | |
extend ActiveSupport::Inflector | |
def self.inflections | |
i = ActiveSupport::Inflector::Inflections.new | |
i.acronym 'SSN' | |
i | |
end | |
end | |
def test_camelize | |
{ | |
'create_wombats' => 'CreateWombats', # passes | |
'create_ssn' => 'CreateSSN', # passes | |
'create_ssns' => 'CreateSSNs' # fails with "CreateSsns" | |
}.each do |k, v| | |
assert_equal v, CodeInflector.camelize(k) | |
end | |
end | |
end | |
class ZeitTest < Minitest::Test | |
def test_camelize | |
i = Zeitwerk::Inflector.new | |
{ | |
'create_wombats' => 'CreateWombats', | |
'create_ssns' => 'CreateSSNs' | |
}.each do |k, v| | |
i.inflect(k => v) | |
assert_equal v, i.camelize(k, '/dev/null') | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment