diff --git a/lib/dry/inflector/inflections/defaults.rb b/lib/dry/inflector/inflections/defaults.rb index f79f476..294164f 100644 --- a/lib/dry/inflector/inflections/defaults.rb +++ b/lib/dry/inflector/inflections/defaults.rb @@ -110,7 +110,7 @@ def self.uncountable(inflect) # @since 0.1.2 # @api private def self.acronyms(inflect) - inflect.acronym(*%w[JSON HTTP OpenSSL HMAC]) + inflect.acronym(*%w[JSON HTTP OpenSSL HMAC CSRF API]) end private_class_method :plural, :singular, :irregular, :uncountable, :acronyms diff --git a/spec/unit/dry/inflector/acronym_spec.rb b/spec/unit/dry/inflector/acronym_spec.rb index 019f214..00940c8 100644 --- a/spec/unit/dry/inflector/acronym_spec.rb +++ b/spec/unit/dry/inflector/acronym_spec.rb @@ -3,7 +3,7 @@ RSpec.describe Dry::Inflector do subject do Dry::Inflector.new do |inflect| - inflect.acronym("API", "RESTful", "RoR", "PhD", "W3C", "SSL", "HTML") + inflect.acronym("RESTful", "RoR", "PhD", "W3C", "SSL", "HTML") end end @@ -29,6 +29,7 @@ ["HTTP::RESTful", "http/restful", "HTTP/RESTful"], ["HTTP::RESTfulAPI", "http/restful_api", "HTTP/RESTful API"], ["APIRESTful", "api_restful", "API RESTful"], + ["CSRF", "csrf", "Cross Site Request Forgery"], # misdirection %w[Capistrano capistrano Capistrano], @@ -42,6 +43,7 @@ expect(subject.camelize(camel)).to eql(camel) expect(subject.underscore(camel)).to eql(under) expect(subject.underscore(under)).to eql(under) + expect(subject.humanize(human)).to eql(human) end end