mini-pro-pkg 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/mini-pro-pkg.gemspec +12 -0
- data/stringex-2.8.6/Gemfile +51 -0
- data/stringex-2.8.6/MIT-LICENSE +20 -0
- data/stringex-2.8.6/README.md +162 -0
- data/stringex-2.8.6/Rakefile +57 -0
- data/stringex-2.8.6/VERSION +1 -0
- data/stringex-2.8.6/init.rb +3 -0
- data/stringex-2.8.6/lib/stringex/acts_as_url/adapter/active_record.rb +23 -0
- data/stringex-2.8.6/lib/stringex/acts_as_url/adapter/base.rb +240 -0
- data/stringex-2.8.6/lib/stringex/acts_as_url/adapter/data_mapper.rb +61 -0
- data/stringex-2.8.6/lib/stringex/acts_as_url/adapter/mongoid.rb +37 -0
- data/stringex-2.8.6/lib/stringex/acts_as_url/adapter.rb +26 -0
- data/stringex-2.8.6/lib/stringex/acts_as_url.rb +107 -0
- data/stringex-2.8.6/lib/stringex/configuration/acts_as_url.rb +50 -0
- data/stringex-2.8.6/lib/stringex/configuration/base.rb +58 -0
- data/stringex-2.8.6/lib/stringex/configuration/configurator.rb +25 -0
- data/stringex-2.8.6/lib/stringex/configuration/string_extensions.rb +20 -0
- data/stringex-2.8.6/lib/stringex/configuration.rb +4 -0
- data/stringex-2.8.6/lib/stringex/configuration_lite.rb +3 -0
- data/stringex-2.8.6/lib/stringex/core_ext.rb +10 -0
- data/stringex-2.8.6/lib/stringex/localization/backend/base.rb +13 -0
- data/stringex-2.8.6/lib/stringex/localization/backend/i18n.rb +86 -0
- data/stringex-2.8.6/lib/stringex/localization/backend/internal.rb +47 -0
- data/stringex-2.8.6/lib/stringex/localization/conversion_expressions.rb +154 -0
- data/stringex-2.8.6/lib/stringex/localization/converter.rb +129 -0
- data/stringex-2.8.6/lib/stringex/localization/default_conversions.rb +89 -0
- data/stringex-2.8.6/lib/stringex/localization.rb +112 -0
- data/stringex-2.8.6/lib/stringex/rails/railtie.rb +10 -0
- data/stringex-2.8.6/lib/stringex/string_extensions.rb +228 -0
- data/stringex-2.8.6/lib/stringex/unidecoder.rb +82 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x00.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x01.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x02.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x03.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x04.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x05.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x06.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x07.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x09.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x0a.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x0b.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x0c.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x0d.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x0e.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x0f.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x10.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x11.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x12.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x13.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x14.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x15.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x16.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x17.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x18.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x1e.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x1f.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x20.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x21.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x22.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x23.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x24.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x25.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x26.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x27.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x28.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x2e.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x2f.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x30.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x31.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x32.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x33.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x4d.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x4e.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x4f.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x50.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x51.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x52.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x53.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x54.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x55.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x56.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x57.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x58.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x59.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x5a.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x5b.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x5c.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x5d.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x5e.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x5f.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x60.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x61.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x62.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x63.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x64.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x65.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x66.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x67.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x68.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x69.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x6a.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x6b.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x6c.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x6d.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x6e.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x6f.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x70.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x71.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x72.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x73.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x74.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x75.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x76.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x77.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x78.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x79.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x7a.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x7b.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x7c.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x7d.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x7e.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x7f.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x80.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x81.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x82.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x83.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x84.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x85.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x86.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x87.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x88.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x89.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x8a.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x8b.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x8c.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x8d.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x8e.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x8f.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x90.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x91.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x92.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x93.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x94.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x95.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x96.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x97.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x98.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x99.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x9a.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x9b.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x9c.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x9d.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x9e.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/x9f.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xa0.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xa1.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xa2.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xa3.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xa4.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xac.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xad.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xae.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xaf.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xb0.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xb1.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xb2.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xb3.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xb4.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xb5.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xb6.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xb7.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xb8.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xb9.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xba.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xbb.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xbc.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xbd.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xbe.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xbf.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xc0.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xc1.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xc2.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xc3.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xc4.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xc5.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xc6.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xc7.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xc8.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xc9.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xca.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xcb.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xcc.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xcd.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xce.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xcf.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xd0.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xd1.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xd2.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xd3.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xd4.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xd5.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xd6.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xd7.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xf9.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xfa.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xfb.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xfc.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xfd.yml +256 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xfe.yml +257 -0
- data/stringex-2.8.6/lib/stringex/unidecoder_data/xff.yml +257 -0
- data/stringex-2.8.6/lib/stringex/version.rb +8 -0
- data/stringex-2.8.6/lib/stringex.rb +17 -0
- data/stringex-2.8.6/lib/stringex_lite.rb +15 -0
- data/stringex-2.8.6/locales/da.yml +76 -0
- data/stringex-2.8.6/locales/de.yml +77 -0
- data/stringex-2.8.6/locales/en.yml +69 -0
- data/stringex-2.8.6/locales/fr.yml +72 -0
- data/stringex-2.8.6/locales/nb.yml +76 -0
- data/stringex-2.8.6/locales/nl.yml +69 -0
- data/stringex-2.8.6/locales/no.yml +76 -0
- data/stringex-2.8.6/locales/pl.yml +88 -0
- data/stringex-2.8.6/locales/pt-BR.yml +69 -0
- data/stringex-2.8.6/locales/ru.yml +69 -0
- data/stringex-2.8.6/locales/sv.yml +76 -0
- data/stringex-2.8.6/stringex.gemspec +290 -0
- data/stringex-2.8.6/test/performance/localization_performance_test.rb +24 -0
- data/stringex-2.8.6/test/test_helper.rb +2 -0
- data/stringex-2.8.6/test/unit/acts_as_url/adapter/activerecord.rb +71 -0
- data/stringex-2.8.6/test/unit/acts_as_url/adapter/datamapper.rb +83 -0
- data/stringex-2.8.6/test/unit/acts_as_url/adapter/mongoid.rb +82 -0
- data/stringex-2.8.6/test/unit/acts_as_url_configuration_test.rb +51 -0
- data/stringex-2.8.6/test/unit/acts_as_url_integration_test.rb +425 -0
- data/stringex-2.8.6/test/unit/localization/da_test.rb +118 -0
- data/stringex-2.8.6/test/unit/localization/de_test.rb +118 -0
- data/stringex-2.8.6/test/unit/localization/default_test.rb +115 -0
- data/stringex-2.8.6/test/unit/localization/en_test.rb +118 -0
- data/stringex-2.8.6/test/unit/localization/fr_test.rb +118 -0
- data/stringex-2.8.6/test/unit/localization/nl_test.rb +118 -0
- data/stringex-2.8.6/test/unit/localization/pl_test.rb +118 -0
- data/stringex-2.8.6/test/unit/localization/pt_br_test.rb +118 -0
- data/stringex-2.8.6/test/unit/localization/ru_test.rb +130 -0
- data/stringex-2.8.6/test/unit/localization/sv_test.rb +118 -0
- data/stringex-2.8.6/test/unit/localization_18n_failure_test.rb +40 -0
- data/stringex-2.8.6/test/unit/localization_test.rb +162 -0
- data/stringex-2.8.6/test/unit/string_extensions_configuration_test.rb +17 -0
- data/stringex-2.8.6/test/unit/string_extensions_test.rb +321 -0
- data/stringex-2.8.6/test/unit/unicode_point_suite/basic_greek_test.rb +113 -0
- data/stringex-2.8.6/test/unit/unicode_point_suite/basic_latin_test.rb +144 -0
- data/stringex-2.8.6/test/unit/unicode_point_suite/codepoint_test_helper.rb +32 -0
- data/stringex-2.8.6/test/unit/unidecoder/bad_localization.yml +1 -0
- data/stringex-2.8.6/test/unit/unidecoder/localization.yml +4 -0
- data/stringex-2.8.6/test/unit/unidecoder_test.rb +104 -0
- data/stringex-2.8.6/test/unit/version_test.rb +12 -0
- metadata +294 -0
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
require 'test_helper'
|
|
4
|
+
|
|
5
|
+
adapter = ENV['ADAPTER'] || 'activerecord'
|
|
6
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), "acts_as_url/adapter/#{adapter}.rb")
|
|
7
|
+
|
|
8
|
+
class ActsAsUrlIntegrationTest < Test::Unit::TestCase
|
|
9
|
+
include AdapterSpecificTestBehaviors
|
|
10
|
+
|
|
11
|
+
def test_should_create_url
|
|
12
|
+
@doc = Document.create(title: "Let's Make a Test Title, <em>Okay</em>?")
|
|
13
|
+
assert_equal "lets-make-a-test-title-okay", @doc.url
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def test_should_create_unique_url
|
|
17
|
+
@doc = Document.create(title: "Unique")
|
|
18
|
+
@other_doc = Document.create(title: "Unique")
|
|
19
|
+
assert_equal "unique", @doc.url
|
|
20
|
+
assert_equal "unique-1", @other_doc.url
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_should_allow_custom_duplicates
|
|
24
|
+
sequence = Enumerator.new { |enum| loop { enum.yield 12345 } }
|
|
25
|
+
Document.class_eval do
|
|
26
|
+
acts_as_url :title, duplicate_sequence: sequence
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
@doc = Document.create(title: "New")
|
|
30
|
+
@other_doc = Document.create(title: "New")
|
|
31
|
+
assert_equal "new-document", @doc.url
|
|
32
|
+
assert_equal "new-document-12345", @other_doc.url
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_should_restart_duplicate_sequence_each_time
|
|
36
|
+
sequence = Enumerator.new do |enum|
|
|
37
|
+
n = 1
|
|
38
|
+
loop do
|
|
39
|
+
enum.yield n
|
|
40
|
+
n += 1
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
Document.class_eval do
|
|
44
|
+
acts_as_url :title, duplicate_sequence: sequence
|
|
45
|
+
end
|
|
46
|
+
@doc = Document.create(title: "Unique")
|
|
47
|
+
@other_doc = Document.create(title: "Unique")
|
|
48
|
+
@third_doc = Document.create(title: "Another")
|
|
49
|
+
@fourth_doc = Document.create(title: "Another")
|
|
50
|
+
assert_equal "unique", @doc.url
|
|
51
|
+
assert_equal "unique-1", @other_doc.url
|
|
52
|
+
assert_equal "another", @third_doc.url
|
|
53
|
+
assert_equal "another-1", @fourth_doc.url
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def test_should_avoid_blacklist
|
|
57
|
+
@doc = Document.create(title: "New")
|
|
58
|
+
@other_doc = Document.create(title: "new")
|
|
59
|
+
assert_equal "new-document", @doc.url
|
|
60
|
+
assert_equal "new-document-1", @other_doc.url
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def test_should_allow_customizing_blacklist
|
|
64
|
+
Document.class_eval do
|
|
65
|
+
# Un-blacklisting 'new' isn't advisable
|
|
66
|
+
acts_as_url :title, blacklist: %w{special}
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
@doc = Document.create(title: "New")
|
|
70
|
+
@other_doc = Document.create(title: "Special")
|
|
71
|
+
assert_equal 'new', @doc.url
|
|
72
|
+
assert_equal 'special-document', @other_doc.url
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def test_should_allow_customizing_blacklist_policy
|
|
76
|
+
Document.class_eval do
|
|
77
|
+
acts_as_url :title, blacklist_policy: Proc.new(){|instance, url|
|
|
78
|
+
"#{url}-customized"
|
|
79
|
+
}
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
@doc = Document.create(title: "New")
|
|
83
|
+
@other_doc = Document.create(title: "New")
|
|
84
|
+
assert_equal 'new-customized', @doc.url
|
|
85
|
+
assert_equal 'new-customized-1', @other_doc.url
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def test_should_create_unique_url_when_partial_url_already_exists
|
|
89
|
+
@doc = Document.create(title: "House Farms")
|
|
90
|
+
@other_doc = Document.create(title: "House Farm")
|
|
91
|
+
|
|
92
|
+
assert_equal "house-farms", @doc.url
|
|
93
|
+
assert_equal "house-farm", @other_doc.url
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def test_should_not_sync_url_by_default
|
|
97
|
+
@doc = Document.create(title: "Stable as Stone")
|
|
98
|
+
@original_url = @doc.url
|
|
99
|
+
adapter_specific_update @doc, title: "New Unstable Madness"
|
|
100
|
+
assert_equal @original_url, @doc.url
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def test_should_allow_syncing_url
|
|
104
|
+
Document.class_eval do
|
|
105
|
+
acts_as_url :title, sync_url: true
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
@doc = Document.create(title: "Original")
|
|
109
|
+
@original_url = @doc.url
|
|
110
|
+
adapter_specific_update @doc, title: "New and Improved"
|
|
111
|
+
assert_not_equal @original_url, @doc.url
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def test_should_not_increment_count_on_repeated_saves
|
|
115
|
+
Document.class_eval do
|
|
116
|
+
acts_as_url :title, sync_url: true
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
@doc = Document.create(title: "Continuous or Constant")
|
|
120
|
+
assert_equal "continuous-or-constant", @doc.url
|
|
121
|
+
5.times do |n|
|
|
122
|
+
@doc.save!
|
|
123
|
+
assert_equal "continuous-or-constant", @doc.url
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def test_should_allow_allowing_duplicate_url
|
|
128
|
+
Document.class_eval do
|
|
129
|
+
acts_as_url :title, allow_duplicates: true
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
@doc = Document.create(title: "I am not a clone")
|
|
133
|
+
@other_doc = Document.create(title: "I am not a clone")
|
|
134
|
+
assert_equal @doc.url, @other_doc.url
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def test_should_allow_scoping_url_uniqueness
|
|
138
|
+
Document.class_eval do
|
|
139
|
+
acts_as_url :title, scope: :other
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
@doc = Document.create(title: "Mocumentary", other: "I don't care if I'm unique for some reason")
|
|
143
|
+
@other_doc = Document.create(title: "Mocumentary", other: "Me either")
|
|
144
|
+
assert_equal @doc.url, @other_doc.url
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def test_should_still_create_unique_urls_if_scoped_attribute_is_the_same
|
|
148
|
+
Document.class_eval do
|
|
149
|
+
acts_as_url :title, scope: :other
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
@doc = Document.create(title: "Mocumentary", other: "Suddenly, I care if I'm unique")
|
|
153
|
+
@other_doc = Document.create(title: "Mocumentary", other: "Suddenly, I care if I'm unique")
|
|
154
|
+
assert_not_equal @doc.url, @other_doc.url
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def test_should_allow_multiple_scopes
|
|
158
|
+
Document.class_eval do
|
|
159
|
+
acts_as_url :title, scope: [:other, :another]
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
@doc = Document.create(title: "Mocumentary", other: "I don't care if I'm unique for some reason",
|
|
163
|
+
another: "Whatever")
|
|
164
|
+
@other_doc = Document.create(title: "Mocumentary", other: "Me either", another: "Whatever")
|
|
165
|
+
assert_equal @doc.url, @other_doc.url
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def test_should_only_create_unique_urls_for_multiple_scopes_if_both_attributes_are_same
|
|
169
|
+
Document.class_eval do
|
|
170
|
+
acts_as_url :title, scope: [:other, :another]
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
@doc = Document.create(title: "Mocumentary", other: "Suddenly, I care if I'm unique",
|
|
174
|
+
another: "Whatever")
|
|
175
|
+
@other_doc = Document.create(title: "Mocumentary", other: "Suddenly, I care if I'm unique",
|
|
176
|
+
another: "Whatever")
|
|
177
|
+
assert_not_equal @doc.url, @other_doc.url
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def test_should_allow_setting_url_attribute
|
|
181
|
+
Document.class_eval do
|
|
182
|
+
# Manually undefining the url method on Document which, in a real class not reused for tests,
|
|
183
|
+
# would never have been defined to begin with.
|
|
184
|
+
remove_method :url
|
|
185
|
+
acts_as_url :title, url_attribute: :other
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
@doc = Document.create(title: "Anything at This Point")
|
|
189
|
+
assert_equal "anything-at-this-point", @doc.other
|
|
190
|
+
assert_nil @doc.url
|
|
191
|
+
ensure
|
|
192
|
+
Document.class_eval do
|
|
193
|
+
# Manually undefining the other method on Document for the same reasons as before
|
|
194
|
+
remove_method :other
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def test_should_allow_updating_url_only_when_blank
|
|
199
|
+
Document.class_eval do
|
|
200
|
+
acts_as_url :title, only_when_blank: true
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
@string = 'the-url-of-concrete'
|
|
204
|
+
@doc = Document.create(title: "Stable as Stone", url: @string)
|
|
205
|
+
assert_equal @string, @doc.url
|
|
206
|
+
@other_doc = Document.create(title: "Stable as Stone")
|
|
207
|
+
assert_equal 'stable-as-stone', @other_doc.url
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def test_should_mass_initialize_urls
|
|
211
|
+
@doc = Document.create(title: "Initial")
|
|
212
|
+
@other_doc = Document.create(title: "Subsequent")
|
|
213
|
+
adapter_specific_update @doc, url: nil
|
|
214
|
+
adapter_specific_update @other_doc, url: nil
|
|
215
|
+
# Just making sure this got unset before the real test
|
|
216
|
+
assert_nil @doc.url
|
|
217
|
+
assert_nil @other_doc.url
|
|
218
|
+
|
|
219
|
+
Document.initialize_urls
|
|
220
|
+
|
|
221
|
+
@doc.reload
|
|
222
|
+
@other_doc.reload
|
|
223
|
+
assert_equal "initial", @doc.url
|
|
224
|
+
assert_equal "subsequent", @other_doc.url
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
def test_should_mass_initialize_urls_with_custom_url_attribute
|
|
228
|
+
Document.class_eval do
|
|
229
|
+
# Manually undefining the url method on Document which, in a real class not reused for tests,
|
|
230
|
+
# would never have been defined to begin with.
|
|
231
|
+
remove_method :url
|
|
232
|
+
acts_as_url :title, url_attribute: :other
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
@doc = Document.create(title: "Initial")
|
|
236
|
+
@other_doc = Document.create(title: "Subsequent")
|
|
237
|
+
adapter_specific_update @doc, other: nil
|
|
238
|
+
adapter_specific_update @other_doc, other: nil
|
|
239
|
+
# Just making sure this got unset before the real test
|
|
240
|
+
assert_nil @doc.other
|
|
241
|
+
assert_nil @other_doc.other
|
|
242
|
+
|
|
243
|
+
Document.initialize_urls
|
|
244
|
+
|
|
245
|
+
@doc.reload
|
|
246
|
+
@other_doc.reload
|
|
247
|
+
assert_equal "initial", @doc.other
|
|
248
|
+
assert_equal "subsequent", @other_doc.other
|
|
249
|
+
ensure
|
|
250
|
+
Document.class_eval do
|
|
251
|
+
# Manually undefining the other method on Document for the same reasons as before
|
|
252
|
+
remove_method :other
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
def test_should_mass_initialize_empty_string_urls
|
|
257
|
+
@doc = Document.create(title: "Initial")
|
|
258
|
+
@other_doc = Document.create(title: "Subsequent")
|
|
259
|
+
adapter_specific_update @doc, url: ''
|
|
260
|
+
adapter_specific_update @other_doc, url: ''
|
|
261
|
+
# Just making sure this got unset before the real test
|
|
262
|
+
assert_equal '', @doc.url
|
|
263
|
+
assert_equal '', @other_doc.url
|
|
264
|
+
|
|
265
|
+
Document.initialize_urls
|
|
266
|
+
|
|
267
|
+
@doc.reload
|
|
268
|
+
@other_doc.reload
|
|
269
|
+
assert_equal "initial", @doc.url
|
|
270
|
+
assert_equal "subsequent", @other_doc.url
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
def test_should_allow_using_custom_method_for_generating_url
|
|
274
|
+
Document.class_eval do
|
|
275
|
+
acts_as_url :non_attribute_method
|
|
276
|
+
|
|
277
|
+
def non_attribute_method
|
|
278
|
+
"#{title} got massaged"
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
@doc = Document.create(title: "Title String")
|
|
283
|
+
assert_equal "title-string-got-massaged", @doc.url
|
|
284
|
+
ensure
|
|
285
|
+
Document.class_eval do
|
|
286
|
+
# Manually undefining method that isn't defined on Document by default
|
|
287
|
+
remove_method :non_attribute_method
|
|
288
|
+
end
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
def test_should_allow_customizing_duplicate_count_separator
|
|
292
|
+
Document.class_eval do
|
|
293
|
+
acts_as_url :title, duplicate_count_separator: "---"
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
@doc = Document.create(title: "Unique")
|
|
297
|
+
@other_doc = Document.create(title: "Unique")
|
|
298
|
+
assert_equal "unique", @doc.url
|
|
299
|
+
assert_equal "unique---1", @other_doc.url
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
def test_should_only_update_url_if_url_attribute_is_valid
|
|
303
|
+
Document.class_eval do
|
|
304
|
+
acts_as_url :title, sync_url: true
|
|
305
|
+
end
|
|
306
|
+
add_validation_on_document_title
|
|
307
|
+
|
|
308
|
+
@doc = Document.create(title: "Valid Record", other: "Present")
|
|
309
|
+
assert_equal "valid-record", @doc.url
|
|
310
|
+
@doc.title = nil
|
|
311
|
+
assert_equal false, @doc.valid?
|
|
312
|
+
assert_equal "valid-record", @doc.url
|
|
313
|
+
ensure
|
|
314
|
+
remove_validation_on_document_title
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
def test_should_allow_customizing_url_limit
|
|
318
|
+
Document.class_eval do
|
|
319
|
+
acts_as_url :title, limit: 13
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
@doc = Document.create(title: "I am much too long")
|
|
323
|
+
assert_equal "i-am-much-too", @doc.url
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
def test_handling_duplicate_urls_with_limits
|
|
327
|
+
Document.class_eval do
|
|
328
|
+
acts_as_url :title, limit: 13
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
@doc = Document.create(title: "I am much too long and also duplicated")
|
|
332
|
+
assert_equal "i-am-much-too", @doc.url
|
|
333
|
+
@other_doc = Document.create(title: "I am much too long and also duplicated")
|
|
334
|
+
assert_equal "i-am-much-too-1", @other_doc.url
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
def test_should_allow_excluding_specific_values_from_being_run_through_to_url
|
|
338
|
+
Document.class_eval do
|
|
339
|
+
acts_as_url :title, exclude: ["_So_Fucking_Special"]
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
@doc = Document.create(title: "_So_Fucking_Special")
|
|
343
|
+
assert_equal "_So_Fucking_Special", @doc.url
|
|
344
|
+
@doc_2 = Document.create(title: "But I'm a creep")
|
|
345
|
+
assert_equal "but-im-a-creep", @doc_2.url
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
def test_should_allow_not_forcing_downcasing
|
|
349
|
+
Document.class_eval do
|
|
350
|
+
acts_as_url :title, force_downcase: false
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
@doc = Document.create(title: "I have CAPS!")
|
|
354
|
+
assert_equal "I-have-CAPS", @doc.url
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
def test_should_allow_alternate_whitespace_replacements
|
|
358
|
+
Document.class_eval do
|
|
359
|
+
acts_as_url :title, replace_whitespace_with: "~"
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
@doc = Document.create(title: "now with tildes")
|
|
363
|
+
assert_equal "now~with~tildes", @doc.url
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
def test_should_allow_enforcing_uniqueness_on_sti_base_class
|
|
367
|
+
STIBaseDocument.class_eval do
|
|
368
|
+
acts_as_url :title, enforce_uniqueness_on_sti_base_class: true
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
@doc = STIChildDocument.create(title: "Unique")
|
|
372
|
+
assert_equal "unique", @doc.url
|
|
373
|
+
@doc_2 = AnotherSTIChildDocument.create(title: "Unique")
|
|
374
|
+
assert_equal "unique-1", @doc_2.url
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
def test_should_strip_slashes_by_default
|
|
378
|
+
Document.class_eval do
|
|
379
|
+
acts_as_url :title
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
@doc = Document.create(title: "a b/c d")
|
|
383
|
+
assert_equal "a-b-slash-c-d", @doc.url
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
def test_should_allow_slashes_to_be_allowed
|
|
387
|
+
Document.class_eval do
|
|
388
|
+
acts_as_url :title, allow_slash: true
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
@doc = Document.create(title: "a b/c d")
|
|
392
|
+
assert_equal "a-b/c-d", @doc.url
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
def test_should_truncate_words_by_default
|
|
396
|
+
Document.class_eval do
|
|
397
|
+
acts_as_url :title, limit: 20
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
@doc = Document.create(title: "title with many whole words")
|
|
401
|
+
assert_equal 'title-with-many-whol', @doc.url
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
def test_should_not_truncate_words
|
|
405
|
+
Document.class_eval do
|
|
406
|
+
acts_as_url :title, limit: 20, truncate_words: false
|
|
407
|
+
end
|
|
408
|
+
|
|
409
|
+
@doc = Document.create(title: "title with many whole words")
|
|
410
|
+
assert_equal 'title-with-many', @doc.url
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
def test_should_allow_overriding_url_taken_method
|
|
414
|
+
Document.class_eval do
|
|
415
|
+
acts_as_url :title, url_taken_method: :url_taken?
|
|
416
|
+
|
|
417
|
+
def url_taken?(url)
|
|
418
|
+
["unique", "unique-1", "unique-2"].include?(url)
|
|
419
|
+
end
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
@doc = Document.create(title: "unique")
|
|
423
|
+
assert_equal "unique-3", @doc.url
|
|
424
|
+
end
|
|
425
|
+
end
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
require 'test_helper'
|
|
4
|
+
require 'i18n'
|
|
5
|
+
require 'stringex'
|
|
6
|
+
|
|
7
|
+
class DanishYAMLLocalizationTest < Test::Unit::TestCase
|
|
8
|
+
def setup
|
|
9
|
+
Stringex::Localization.reset!
|
|
10
|
+
Stringex::Localization.backend = :i18n
|
|
11
|
+
Stringex::Localization.backend.load_translations :da
|
|
12
|
+
Stringex::Localization.locale = :da
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
{
|
|
16
|
+
"foo & bar" => "foo og bar",
|
|
17
|
+
"AT&T" => "AT og T",
|
|
18
|
+
"99° is normal" => "99 grader is normal",
|
|
19
|
+
"4 ÷ 2 is 2" => "4 divideret med 2 is 2",
|
|
20
|
+
"webcrawler.com" => "webcrawler punktum com",
|
|
21
|
+
"Well..." => "Well prik prik prik",
|
|
22
|
+
"x=1" => "x lig med 1",
|
|
23
|
+
"a #2 pencil" => "a nummer 2 pencil",
|
|
24
|
+
"100%" => "100 procent",
|
|
25
|
+
"cost+tax" => "cost plus tax",
|
|
26
|
+
"batman/robin fan fiction" => "batman skråstreg robin fan fiction",
|
|
27
|
+
"dial *69" => "dial stjerne 69",
|
|
28
|
+
" i leave whitespace on ends unchanged " => " i leave whitespace on ends unchanged "
|
|
29
|
+
}.each do |original, converted|
|
|
30
|
+
define_method "test_character_conversion: '#{original}'" do
|
|
31
|
+
assert_equal converted, original.convert_miscellaneous_characters
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
{
|
|
36
|
+
"¤20" => "20 kroner",
|
|
37
|
+
"$100" => "100 dollars",
|
|
38
|
+
"$19.99" => "19 dollars 99 cents",
|
|
39
|
+
"£100" => "100 pund",
|
|
40
|
+
"£19.99" => "19 pund 99 pence",
|
|
41
|
+
"€100" => "100 euro",
|
|
42
|
+
"€19.99" => "19 euro 99 cent",
|
|
43
|
+
"¥1000" => "1000 yen"
|
|
44
|
+
}.each do |original, converted|
|
|
45
|
+
define_method "test_currency_conversion: '#{original}'" do
|
|
46
|
+
assert_equal converted, original.convert_miscellaneous_characters
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
{
|
|
51
|
+
"Tea & Sympathy" => "Tea og Sympathy",
|
|
52
|
+
"10¢" => "10 cents",
|
|
53
|
+
"©2000" => "(c)2000",
|
|
54
|
+
"98° is fine" => "98 grader is fine",
|
|
55
|
+
"10÷5" => "10 divideret med 5",
|
|
56
|
+
""quoted"" => '"quoted"',
|
|
57
|
+
"to be continued…" => "to be continued...",
|
|
58
|
+
"2000–2004" => "2000-2004",
|
|
59
|
+
"I wish—oh, never mind" => "I wish--oh, never mind",
|
|
60
|
+
"½ ounce of gold" => "halv ounce of gold",
|
|
61
|
+
"1 and ¼ ounces of silver" => "1 and en fjerdedel ounces of silver",
|
|
62
|
+
"9 and ¾ ounces of platinum" => "9 and tre fjerdedele ounces of platinum",
|
|
63
|
+
"3>2" => "3>2",
|
|
64
|
+
"2<3" => "2<3",
|
|
65
|
+
"two words" => "two words",
|
|
66
|
+
"£100" => "pund 100",
|
|
67
|
+
"Walmart®" => "Walmart(r)",
|
|
68
|
+
"'single quoted'" => "'single quoted'",
|
|
69
|
+
"2×4" => "2x4",
|
|
70
|
+
"Programming™" => "Programming(tm)",
|
|
71
|
+
"¥20000" => "yen 20000",
|
|
72
|
+
" i leave whitespace on ends unchanged " => " i leave whitespace on ends unchanged "
|
|
73
|
+
}.each do |original, converted|
|
|
74
|
+
define_method "test_html_entity_conversion: '#{original}'" do
|
|
75
|
+
assert_equal converted, original.convert_miscellaneous_html_entities
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
{
|
|
80
|
+
"½" => "halv",
|
|
81
|
+
"½" => "halv",
|
|
82
|
+
"½" => "halv",
|
|
83
|
+
"⅓" => "en tredjedel",
|
|
84
|
+
"⅓" => "en tredjedel",
|
|
85
|
+
"⅔" => "to tredjedele",
|
|
86
|
+
"⅔" => "to tredjedele",
|
|
87
|
+
"¼" => "en fjerdedel",
|
|
88
|
+
"¼" => "en fjerdedel",
|
|
89
|
+
"¼" => "en fjerdedel",
|
|
90
|
+
"¾" => "tre fjerdedele",
|
|
91
|
+
"¾" => "tre fjerdedele",
|
|
92
|
+
"¾" => "tre fjerdedele",
|
|
93
|
+
"⅕" => "en femtedel",
|
|
94
|
+
"⅕" => "en femtedel",
|
|
95
|
+
"⅖" => "to femtedele",
|
|
96
|
+
"⅖" => "to femtedele",
|
|
97
|
+
"⅗" => "tre femtedele",
|
|
98
|
+
"⅗" => "tre femtedele",
|
|
99
|
+
"⅘" => "fire femtedele",
|
|
100
|
+
"⅘" => "fire femtedele",
|
|
101
|
+
"⅙" => "en sjettedel",
|
|
102
|
+
"⅙" => "en sjettedel",
|
|
103
|
+
"⅚" => "fem sjettedele",
|
|
104
|
+
"⅚" => "fem sjettedele",
|
|
105
|
+
"⅛" => "en ottendedel",
|
|
106
|
+
"⅛" => "en ottendedel",
|
|
107
|
+
"⅜" => "tre ottendedele",
|
|
108
|
+
"⅜" => "tre ottendedele",
|
|
109
|
+
"⅝" => "fem ottendedele",
|
|
110
|
+
"⅝" => "fem ottendedele",
|
|
111
|
+
"⅞" => "syv ottendedele",
|
|
112
|
+
"⅞" => "syv ottendedele"
|
|
113
|
+
}.each do |original, converted|
|
|
114
|
+
define_method "test_vulgar_fractions_conversion: #{original}" do
|
|
115
|
+
assert_equal converted, original.convert_vulgar_fractions
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
require 'test_helper'
|
|
4
|
+
require 'i18n'
|
|
5
|
+
require 'stringex'
|
|
6
|
+
|
|
7
|
+
class GermanYAMLLocalizationTest < Test::Unit::TestCase
|
|
8
|
+
def setup
|
|
9
|
+
Stringex::Localization.reset!
|
|
10
|
+
Stringex::Localization.backend = :i18n
|
|
11
|
+
Stringex::Localization.backend.load_translations :de
|
|
12
|
+
Stringex::Localization.locale = :de
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
{
|
|
16
|
+
"foo & bar" => "foo und bar",
|
|
17
|
+
"AT&T" => "AT und T",
|
|
18
|
+
"99° sind normal" => "99 Grad sind normal",
|
|
19
|
+
"4 ÷ 2 ist 2" => "4 geteilt durch 2 ist 2",
|
|
20
|
+
"webcrawler.com" => "webcrawler Punkt com",
|
|
21
|
+
"Nun..." => "Nun Punkt Punkt Punkt",
|
|
22
|
+
"x=1" => "x gleich 1",
|
|
23
|
+
"Ein #2 Stift" => "Ein Nummer 2 Stift",
|
|
24
|
+
"100%" => "100 Prozent",
|
|
25
|
+
"Kosten+Steuern" => "Kosten plus Steuern",
|
|
26
|
+
"Batman/Robin Fan Fiction" => "Batman Strich Robin Fan Fiction",
|
|
27
|
+
"Wähle *69" => "Wähle Stern 69",
|
|
28
|
+
" i leave whitespace on ends unchanged " => " i leave whitespace on ends unchanged "
|
|
29
|
+
}.each do |original, converted|
|
|
30
|
+
define_method "test_character_conversion: '#{original}'" do
|
|
31
|
+
assert_equal converted, original.convert_miscellaneous_characters
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
{
|
|
36
|
+
"¤20" => "20 Euro",
|
|
37
|
+
"$100" => "100 Dollar",
|
|
38
|
+
"$19.99" => "19 Dollar 99 Cent",
|
|
39
|
+
"£100" => "100 Pfund",
|
|
40
|
+
"£19.99" => "19 Pfund 99 Pence",
|
|
41
|
+
"€100" => "100 Euro",
|
|
42
|
+
"€19.99" => "19 Euro 99 Cent",
|
|
43
|
+
"¥1000" => "1000 Yen"
|
|
44
|
+
}.each do |original, converted|
|
|
45
|
+
define_method "test_currency_conversion: '#{original}'" do
|
|
46
|
+
assert_equal converted, original.convert_miscellaneous_characters
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
{
|
|
51
|
+
"Hennes & Mauritz" => "Hennes und Mauritz",
|
|
52
|
+
"10¢" => "10 Cent",
|
|
53
|
+
"©2000" => "(C)2000",
|
|
54
|
+
"98° sind ok" => "98 Grad sind ok",
|
|
55
|
+
"10÷5" => "10 geteilt durch 5",
|
|
56
|
+
""zitiert"" => '"zitiert"',
|
|
57
|
+
"Fortsetzung folgt…" => "Fortsetzung folgt...",
|
|
58
|
+
"2000–2004" => "2000-2004",
|
|
59
|
+
"Ich wünschte—oh, ach nichts" => "Ich wünschte--oh, ach nichts",
|
|
60
|
+
"½ Unze Gold" => "halbe(r) Unze Gold",
|
|
61
|
+
"1 und ¼ Unzen Silber" => "1 und ein Viertel Unzen Silber",
|
|
62
|
+
"9 und ¾ Unzen Platin" => "9 und drei Viertel Unzen Platin",
|
|
63
|
+
"3>2" => "3>2",
|
|
64
|
+
"2<3" => "2<3",
|
|
65
|
+
"zwei Worte" => "zwei Worte",
|
|
66
|
+
"100£" => "100 Pfund",
|
|
67
|
+
"Walmart®" => "Walmart(R)",
|
|
68
|
+
"'einfach zitiert'" => "'einfach zitiert'",
|
|
69
|
+
"2×4" => "2x4",
|
|
70
|
+
"Programming™" => "Programming(TM)",
|
|
71
|
+
"20000¥" => "20000 Yen",
|
|
72
|
+
" i leave whitespace on ends unchanged " => " i leave whitespace on ends unchanged "
|
|
73
|
+
}.each do |original, converted|
|
|
74
|
+
define_method "test_html_entity_conversion: '#{original}'" do
|
|
75
|
+
assert_equal converted, original.convert_miscellaneous_html_entities
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
{
|
|
80
|
+
"½" => "halbe(r)",
|
|
81
|
+
"½" => "halbe(r)",
|
|
82
|
+
"½" => "halbe(r)",
|
|
83
|
+
"⅓" => "ein Drittel",
|
|
84
|
+
"⅓" => "ein Drittel",
|
|
85
|
+
"⅔" => "zwei Drittel",
|
|
86
|
+
"⅔" => "zwei Drittel",
|
|
87
|
+
"¼" => "ein Viertel",
|
|
88
|
+
"¼" => "ein Viertel",
|
|
89
|
+
"¼" => "ein Viertel",
|
|
90
|
+
"¾" => "drei Viertel",
|
|
91
|
+
"¾" => "drei Viertel",
|
|
92
|
+
"¾" => "drei Viertel",
|
|
93
|
+
"⅕" => "ein Fünftel",
|
|
94
|
+
"⅕" => "ein Fünftel",
|
|
95
|
+
"⅖" => "zwei Fünftel",
|
|
96
|
+
"⅖" => "zwei Fünftel",
|
|
97
|
+
"⅗" => "drei Fünftel",
|
|
98
|
+
"⅗" => "drei Fünftel",
|
|
99
|
+
"⅘" => "vier Fünftel",
|
|
100
|
+
"⅘" => "vier Fünftel",
|
|
101
|
+
"⅙" => "ein Sechstel",
|
|
102
|
+
"⅙" => "ein Sechstel",
|
|
103
|
+
"⅚" => "fünf Sechstel",
|
|
104
|
+
"⅚" => "fünf Sechstel",
|
|
105
|
+
"⅛" => "ein Achtel",
|
|
106
|
+
"⅛" => "ein Achtel",
|
|
107
|
+
"⅜" => "drei Achtel",
|
|
108
|
+
"⅜" => "drei Achtel",
|
|
109
|
+
"⅝" => "fünf Achtel",
|
|
110
|
+
"⅝" => "fünf Achtel",
|
|
111
|
+
"⅞" => "sieben Achtel",
|
|
112
|
+
"⅞" => "sieben Achtel"
|
|
113
|
+
}.each do |original, converted|
|
|
114
|
+
define_method "test_vulgar_fractions_conversion: #{original}" do
|
|
115
|
+
assert_equal converted, original.convert_vulgar_fractions
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|