awesome_translations 0.0.57 → 0.0.61
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Rakefile +1 -1
- data/app/controllers/awesome_translations/clean_ups_controller.rb +1 -1
- data/app/controllers/awesome_translations/groups_controller.rb +1 -0
- data/app/controllers/awesome_translations/handlers_controller.rb +1 -0
- data/app/helpers/awesome_translations/application_helper.rb +0 -1
- data/app/models/awesome_translations/group.rb +2 -2
- data/app/models/awesome_translations/translated_value.rb +6 -3
- data/app/models/awesome_translations/translation.rb +9 -4
- data/app/views/awesome_translations/duplicates/index.html.erb +2 -2
- data/app/views/awesome_translations/groups/show.html.erb +9 -4
- data/app/views/awesome_translations/handler_translations/index.html.erb +21 -6
- data/app/views/awesome_translations/handlers/show.html.erb +29 -6
- data/app/views/awesome_translations/movals/index.html.erb +2 -2
- data/lib/awesome_translations/cache_database_generator/group.rb +10 -3
- data/lib/awesome_translations/cache_database_generator/handler.rb +9 -2
- data/lib/awesome_translations/cache_database_generator/handler_translation.rb +13 -3
- data/lib/awesome_translations/cache_database_generator/translation_key.rb +4 -4
- data/lib/awesome_translations/cache_database_generator/translation_value.rb +3 -1
- data/lib/awesome_translations/cache_database_generator.rb +2 -2
- data/lib/awesome_translations/config.rb +3 -3
- data/lib/awesome_translations/controller_translate_functionality.rb +2 -2
- data/lib/awesome_translations/engine.rb +0 -4
- data/lib/awesome_translations/erb_inspector/file_inspector.rb +4 -4
- data/lib/awesome_translations/erb_inspector/translation_inspector.rb +8 -8
- data/lib/awesome_translations/erb_inspector.rb +1 -0
- data/lib/awesome_translations/global_translator.rb +14 -28
- data/lib/awesome_translations/handlers/file_handler.rb +1 -0
- data/lib/awesome_translations/handlers/model_handler.rb +1 -1
- data/lib/awesome_translations/handlers/validations_handler.rb +4 -4
- data/lib/awesome_translations/handlers.rb +1 -0
- data/lib/awesome_translations/model_inspector.rb +23 -17
- data/lib/awesome_translations/object_extensions.rb +2 -2
- data/lib/awesome_translations/translation_migrator.rb +3 -3
- data/lib/awesome_translations/version.rb +1 -1
- data/lib/awesome_translations.rb +1 -1
- data/lib/tasks/awesome_translations_tasks.rake +1 -4
- data/spec/controllers/groups_controller_spec.rb +5 -5
- data/spec/controllers/handlers_controller_spec.rb +4 -4
- data/spec/controllers/users_controller_spec.rb +4 -2
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/app/assets/config/manifest.js +3 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -7
- data/spec/dummy/app/controllers/users_controller.rb +1 -1
- data/spec/dummy/app/mailers/my_mailer.rb +1 -1
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/role.rb +2 -5
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/dummy/bin/bundle +1 -1
- data/spec/dummy/bin/rails +1 -1
- data/spec/dummy/config/application.rb +7 -2
- data/spec/dummy/config/boot.rb +2 -2
- data/spec/dummy/config/environment.rb +1 -1
- data/spec/dummy/config.ru +1 -1
- data/spec/dummy/db/awesome_translations.sqlite3 +0 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +52 -0
- data/spec/dummy/log/test.log +770 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/2m/2mnPY9uUnBNkGHLxtFaWv5hB3oA7sY2K1ZtwQlZLnAY.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/3N/3NnKgR2TsTI1qCXKZpts0uJzp2dRJcoYp3nnFU6YE4o.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/5r/5rpKlqLSFsRCibev7g6MQkIOhWuOah-1KAN3aqV_fYI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/6E/6ExTs_VkmUe-fovt99Kw8rq-xCfx0_qGsSoldSWScZI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/8O/8OrG8phjC9s5-_7GAI2TEmRjsrGsuvq1gnJQPdMm8v8.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/8f/8f4REKYOWkNfHexyAVqGXnbOP3vky_ANapWzlRMDeQ4.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/8n/8n_viDw_qMQaQmqHM0ObPADed5uRyEYo3gDZIiTqUyA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/9e/9euY4B26kaHeiqfd1Qc0bsfRjpzmq36X6uqUfaRNtIs.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/AB/AB5PxrhEqi8qOm7AmSf-sHDs9ffj_iTsytaHas2ryPA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/AI/AICJO1oM9dzlQ_N1QlHcCN9e8PC0wjtYk7-VmuNdfwg.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Ca/CaGQBiCuFgkHQ5gw8ZnGQqO8iP1md3GcllDsmaKBFdQ.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Ch/ChWez9UVXMuuBpLJMDRGuDmMuXy8gIuFo6794-wBgXc.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/D9/D9eOwgl8pLlC7LJu-LL59UeHm9d-CH1mPgsA8j6xkMg.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Do/Do83AoOat5W-c1g7piDGy2GMmffsY6JY0Qfuh5PY3GM.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Hn/Hn53895nYKzu-g1FJKYS_yszYqCADXasTmN615R_qMQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/It/ItV7jxV0bfHndR-H3cidDwpTFGhvs0ETLRqCTmZMXB8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/LL/LL0EenAcTXP-UNCqfcKtMF4Z8oDeWvdlwLQfuOVRPdw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Mj/MjwYGG9GkHD1fwwH2bg66EBYl3zCA_mqeDF9otey4-U.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/NU/NUN9oO9gyoo-sY32AOLHdDACjLIxisCxXdKd84ou6cs.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Ob/ObuKkBd-camcT52YpgeuyheU-GDFLZCJnoVtq2plgW0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Og/Og_HPfE6734sqkQ0_h4EkOOx3Aoq1LABLH9ovjl6Bvw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Pw/Pwuhz_6So_JcSrxT0Uf4VaLhh_FFSJMKxLZFMbS0LNQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/R-/R-nohuDiORrLlJJtKc5bQsjIRS8yTQFVR3EIxJx3JZw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/SX/SXA6qKBlsAQ-MLPi7-KPCPcSx9Gg2VR1xa-lCmgipgA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Sb/Sb1Vug319YfPL2Rci1PLMLXJjeIFYcNbHb5hKOvO1eo.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/_f/_f0DjbdXTMEPb52THCCF5qbKkDs28tHHnap5ag4jsdU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/dT/dTb1O_9BwFdhA3VT1UTxY-XIIoAGDHGHVO9bzRUNIfc.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/dV/dVTKOfd8qDIHT3VD-4emnl0yAIxcSF1pY0CUESPHwdM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/i0/i0TQIUsntlYrsibtn9YfB3qbI6bj8hLPom8KUfxR078.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/jF/jFFXBsyFdv_TiNykX219AHs3Q7dQInYRP_80cAWZsgE.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/mX/mXfx3VRudxpXrRx1aejtNA5YHOwND3kwWUfvdXHSors.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/nG/nGQXdOLWsP4c926DJJBNXFUE0cKfZynnqN5aQ4T1I48.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/oX/oXeqOS7RZb4eFbKrraeQtr6TUrXPTueLN_Crp7S0RLE.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/p2/p27Ube4R6tciXRc0F8lpz6wUzmXIPxwqz7dKaUYVVuc.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/pv/pv6tV3CDkIAmLXdU8EPLlNEkXAKJPufVD4VP30o4fWo.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/q6/q6BYa32YJF11eGVapO4ouNl6gayPIsARgMavlzZmoi0.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/r5/r5draRYO72lGMZZKpqYbscAWxAawJVG7uO0uyx3iw24.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/r7/r7kGQJTsdrqs3i-prYAVnngsoc6uAtrjLTULTJdgy9g.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/rI/rITk_65QtUwq61bjRPAksGeJxbLUFfz-sFPnQiZPHjw.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/rR/rRS9OkVGJ9Wvs1fwZH-raqD4sXkbV8WmlLGIibYpZmI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/u9/u9nsXMBU9hA4UnH4SDHgk19ev_JNeeiS1-EZDrgStCI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/un/unZXcRqhGJwHvVWJmJ1rTizBZq6H5jF28E5-FHyTYL4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/wP/wP-1NwhQC0Sp_5PHpwAI7N0_N99vLNy0TA2FcMd6zgE.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/x7/x7KkTV3ibfIEysLB_ug5bfmnn2VLV_BldukPR3EoPBk.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/xr/xrDdkyCzfXr-pIE8gfvD8iFiWPuq9EwuZIl-uU9s0_o.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/yc/yc3EXb1cvVLmwnk8aQN89bgVFeuwsVz2k2p0mvC2c3c.cache +1 -0
- data/spec/factories/group.rb +2 -2
- data/spec/factories/handler.rb +4 -4
- data/spec/factories/handler_translation.rb +5 -5
- data/spec/factories/translation_key.rb +1 -1
- data/spec/factories/translation_value.rb +3 -3
- data/spec/features/clean_ups_spec.rb +2 -5
- data/spec/features/duplicates_spec.rb +5 -7
- data/spec/features/movals_spec.rb +8 -10
- data/spec/handlers/file_handler_spec.rb +8 -8
- data/spec/handlers/model_handler_spec.rb +4 -4
- data/spec/handlers/validations_handler_spec.rb +3 -3
- data/spec/handlers_spec.rb +1 -1
- data/spec/lib/cache_database_generator_spec.rb +4 -4
- data/spec/lib/erb_inspector/file_inspector_spec.rb +2 -2
- data/spec/lib/erb_inspector/translation_inspector_spec.rb +2 -2
- data/spec/lib/erb_inspector_spec.rb +5 -5
- data/spec/lib/model_inspector_spec.rb +4 -4
- data/spec/lib/translation_migrator_spec.rb +3 -3
- data/spec/models/awesome_translations/handler_spec.rb +1 -1
- data/spec/models/awesome_translations/translated_value_spec.rb +1 -3
- data/spec/models/awesome_translations/translation_spec.rb +7 -2
- data/spec/spec_helper.rb +7 -8
- metadata +186 -101
- data/config/initializers/simple_form_ransack.rb +0 -1
@@ -0,0 +1,2 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash}I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"1processors:type=text/css&file_type=text/scss;TTI"zfile-digest:///home/dev/Development/awesome_translations/app/assets/stylesheets/awesome_translations/application.scss;TTI"?processors:type=text/css&file_type=text/scss&pipeline=self;TTI"ufile-digest:///home/dev/Development/awesome_translations/app/assets/stylesheets/awesome_translations/groups.scss;TTF
|
@@ -0,0 +1,2 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash}I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Lprocessors:type=application/javascript&file_type=application/javascript;TTI"8file-digest://app/assets/javascripts/application.js;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTF
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�/home/dev/Development/awesome_translations/app/assets/stylesheets/awesome_translations/application.scss?type=text/css&pipeline=self&id=8f6d91c9e9738d7eb89b1afcb885f93d3ced675e134504178a6cab61d97d89eb:ET
|
Binary file
|
@@ -0,0 +1,3 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash}
|
3
|
+
I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"xfile-digest:///home/dev/Development/awesome_translations/app/assets/javascripts/awesome_translations/application.js;TTF
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=cd690edccdd0a0a00aaa35f0950b77e22a23c70fa51ae6c582d5f00164093b6c:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�/home/dev/Development/awesome_translations/app/assets/stylesheets/awesome_translations/application.scss?type=text/css&id=65d66091d21edab70ef798e305fbbbbf55dfeebeec31697d9df49f393c631c50:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
"%+f����5���N�E�Ȼ�����@��<"���
|
Binary file
|
@@ -0,0 +1,2 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash}I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"?processors:type=text/css&file_type=text/scss&pipeline=self;TTI"zfile-digest:///home/dev/Development/awesome_translations/app/assets/stylesheets/awesome_translations/application.scss;TTI"ufile-digest:///home/dev/Development/awesome_translations/app/assets/stylesheets/awesome_translations/groups.scss;TTF
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=bade2183fbf3165fd2ea4f36670e84338d4c74f8a8be8641211f1c7cd717b4b2:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
"%��Rm�v�S3.��O�L���ڹc�ƕq�=_j�
|
@@ -0,0 +1,2 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash}I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"0file-digest://app/assets/config/manifest.js;TTI"$file-digest://app/assets/images;TTI")file-digest://app/assets/javascripts;TTI"8file-digest://app/assets/javascripts/application.js;TTI"9file-digest://app/assets/javascripts/translations.js;TTI")file-digest://app/assets/stylesheets;TTI"9file-digest://app/assets/stylesheets/application.css;TTF
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/javascripts/translations.js?type=application/javascript&id=c3be52e6babb59f49bc45b2908a64c0dcd21a814759626ae2afad501aeaee6f0:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/javascripts/application.js?type=application/javascript&id=d5186d65c547d6cd9bc78150ff19d2257c105dc3c649d86c527cbde0c077d4b0:ET
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
"%��B�����șo�$'�A�d��L���xR�U
|
@@ -0,0 +1 @@
|
|
1
|
+
I"}app/assets/stylesheets/application.css?type=text/css&id=c3c028504989adf81c83b3336a2842acb7600054c6bb11bd941d3b3625b9d4f4:ET
|
@@ -0,0 +1,2 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash}I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Lprocessors:type=application/javascript&file_type=application/javascript;TTI"9file-digest://app/assets/javascripts/translations.js;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTF
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
"%��B�����șo�$'�A�d��L���xR�U
|
Binary file
|
@@ -0,0 +1,2 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash}I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Lprocessors:type=application/javascript&file_type=application/javascript;TTI"xfile-digest:///home/dev/Development/awesome_translations/app/assets/javascripts/awesome_translations/application.js;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTF
|
@@ -0,0 +1 @@
|
|
1
|
+
"%*��}�yB?x��{w�KBq����5=��
|
@@ -0,0 +1 @@
|
|
1
|
+
"%�ku9FJʚ�$M���=s���:�BwbՈ%��-�
|
@@ -0,0 +1 @@
|
|
1
|
+
"%�=��=Z@��ȖV'Q��0߅ch9xJ��|K
|
@@ -0,0 +1,2 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash}I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Lprocessors:type=application/javascript&file_type=application/javascript;TTI"0file-digest://app/assets/config/manifest.js;TTI"8file-digest://app/assets/javascripts/application.js;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"9file-digest://app/assets/javascripts/translations.js;TTI"0processors:type=text/css&file_type=text/css;TTI"9file-digest://app/assets/stylesheets/application.css;TTI">processors:type=text/css&file_type=text/css&pipeline=self;TTI")file-digest://app/assets/stylesheets;TTI"$file-digest://app/assets/images;TTI")file-digest://app/assets/javascripts;TTF
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�/home/dev/Development/awesome_translations/app/assets/javascripts/awesome_translations/application.js?type=application/javascript&id=f27330e7f810a85683dd5aa05a1801d663943594a8b1755bc2aadd421edde806:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/config/manifest.js?type=application/javascript&pipeline=self&id=95ca277002eef1086af23325a3588fe4ff8524e9b3788149a28454d2f5f4f02b:ET
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/javascripts/translations.js?type=application/javascript&pipeline=self&id=b9dcbfb1c62c86a82e0b61ff094257970a00cd2699f9dcf1aa57864e56e505dd:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
I"}app/assets/config/manifest.js?type=application/javascript&id=8acaa94dcec260a4b91495367e843c5d681fdc9146bd5f9bda713f44a78e9401:ET
|
Binary file
|
@@ -0,0 +1,2 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash}I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"0processors:type=text/css&file_type=text/css;TTI"9file-digest://app/assets/stylesheets/application.css;TTI">processors:type=text/css&file_type=text/css&pipeline=self;TTI")file-digest://app/assets/stylesheets;TTF
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�/home/dev/Development/awesome_translations/app/assets/javascripts/awesome_translations/application.js?type=application/javascript&pipeline=self&id=332458c2a49c3eb7751b037ee54b84bf0cbe17a7b0cd81a6b8a96566d07ad1e9:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
"%��B�����șo�$'�A�d��L���xR�U
|
data/spec/factories/group.rb
CHANGED
data/spec/factories/handler.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :handler, class: "AwesomeTranslations::CacheDatabaseGenerator::Handler" do
|
3
|
-
identifier "rails_handler"
|
4
|
-
name "RailsHandler"
|
3
|
+
identifier { "rails_handler" }
|
4
|
+
name { "RailsHandler" }
|
5
5
|
|
6
6
|
factory :model_handler do
|
7
|
-
identifier "model_handler"
|
8
|
-
name "ModelHandler"
|
7
|
+
identifier { "model_handler" }
|
8
|
+
name { "ModelHandler" }
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -4,10 +4,10 @@ FactoryBot.define do
|
|
4
4
|
translation_key
|
5
5
|
group
|
6
6
|
|
7
|
-
key_show "some.key"
|
8
|
-
file_path nil
|
9
|
-
line_no nil
|
10
|
-
full_path nil
|
11
|
-
dir
|
7
|
+
key_show { "some.key" }
|
8
|
+
file_path { nil }
|
9
|
+
line_no { nil }
|
10
|
+
full_path { nil }
|
11
|
+
dir { Rails.root.join("config/locales/awesome_translations/some/key") }
|
12
12
|
end
|
13
13
|
end
|
@@ -2,8 +2,8 @@ FactoryBot.define do
|
|
2
2
|
factory :translation_value, class: "AwesomeTranslations::CacheDatabaseGenerator::TranslationValue" do
|
3
3
|
translation_key
|
4
4
|
|
5
|
-
file_path
|
6
|
-
locale "en"
|
7
|
-
value "English"
|
5
|
+
file_path { Rails.root.join("config/locales/some_file.yml") }
|
6
|
+
locale { "en" }
|
7
|
+
value { "English" }
|
8
8
|
end
|
9
9
|
end
|
@@ -7,7 +7,7 @@ describe AwesomeTranslations::CleanUpsController do
|
|
7
7
|
create :translation_value,
|
8
8
|
translation_key: translation_key,
|
9
9
|
locale: "da",
|
10
|
-
file_path:
|
10
|
+
file_path: Rails.root.join("config/locales/awesome_translations/some_file.yml")
|
11
11
|
end
|
12
12
|
let(:content) do
|
13
13
|
{
|
@@ -21,10 +21,7 @@ describe AwesomeTranslations::CleanUpsController do
|
|
21
21
|
|
22
22
|
before do
|
23
23
|
FileUtils.mkdir_p(File.dirname(translation_value.file_path))
|
24
|
-
|
25
|
-
File.open(translation_value.file_path, "w") do |fp|
|
26
|
-
fp.write(YAML.dump(content))
|
27
|
-
end
|
24
|
+
File.write(translation_value.file_path, YAML.dump(content))
|
28
25
|
end
|
29
26
|
|
30
27
|
it "works" do
|
@@ -4,18 +4,18 @@ describe AwesomeTranslations::DuplicatesController do
|
|
4
4
|
let!(:handler_translation) do
|
5
5
|
create :handler_translation,
|
6
6
|
translation_key: translation_key,
|
7
|
-
dir: Rails.root.join("config
|
7
|
+
dir: Rails.root.join("config/locales/some/right/path")
|
8
8
|
end
|
9
9
|
let!(:translation_key) { create :translation_key, key: "some.key" }
|
10
10
|
let!(:translation_value) do
|
11
11
|
create :translation_value,
|
12
12
|
translation_key: translation_key,
|
13
|
-
file_path: Rails.root.join("config
|
13
|
+
file_path: Rails.root.join("config/locales/some/right/path/en.yml")
|
14
14
|
end
|
15
15
|
let!(:translation_value_duplicate) do
|
16
16
|
create :translation_value,
|
17
17
|
translation_key: translation_key,
|
18
|
-
file_path: Rails.root.join("config
|
18
|
+
file_path: Rails.root.join("config/locales/some/wrong/path/en.yml")
|
19
19
|
end
|
20
20
|
|
21
21
|
before do
|
@@ -30,9 +30,7 @@ describe AwesomeTranslations::DuplicatesController do
|
|
30
30
|
}
|
31
31
|
}
|
32
32
|
|
33
|
-
File.
|
34
|
-
fp.write(YAML.dump(translation_yaml))
|
35
|
-
end
|
33
|
+
File.write(translation_value_duplicate.file_path, YAML.dump(translation_yaml))
|
36
34
|
end
|
37
35
|
|
38
36
|
describe "#index" do
|
@@ -40,7 +38,7 @@ describe AwesomeTranslations::DuplicatesController do
|
|
40
38
|
visit duplicates_path
|
41
39
|
|
42
40
|
expect(page).to have_http_status(:success)
|
43
|
-
expect(
|
41
|
+
expect(page).to have_current_path duplicates_path, ignore_query: true
|
44
42
|
|
45
43
|
find("input[type=checkbox][name='d[#{translation_value_duplicate.id}]']")
|
46
44
|
|
@@ -1,16 +1,16 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe AwesomeTranslations::MovalsController do
|
3
|
+
describe AwesomeTranslations::MovalsController do # rubocop:disable RSpec/MultipleMemoizedHelpers
|
4
4
|
let!(:handler_translation) do
|
5
5
|
create :handler_translation,
|
6
6
|
translation_key: translation_key,
|
7
|
-
dir: Rails.root.join("config
|
7
|
+
dir: Rails.root.join("config/locales/some/right/path")
|
8
8
|
end
|
9
9
|
let!(:translation_key) { create :translation_key, key: "some.key" }
|
10
10
|
let!(:translation_value) do
|
11
11
|
create :translation_value,
|
12
12
|
translation_key: translation_key,
|
13
|
-
file_path: Rails.root.join("config
|
13
|
+
file_path: Rails.root.join("config/locales/some/wrong/path/en.yml")
|
14
14
|
end
|
15
15
|
|
16
16
|
let!(:handler_translation_right_path) { create :handler_translation, translation_key: translation_key_right_path, dir: "/some/path" }
|
@@ -29,17 +29,15 @@ describe AwesomeTranslations::MovalsController do
|
|
29
29
|
}
|
30
30
|
}
|
31
31
|
|
32
|
-
File.
|
33
|
-
fp.write(YAML.dump(translation_yaml))
|
34
|
-
end
|
32
|
+
File.write(translation_value.file_path, YAML.dump(translation_yaml))
|
35
33
|
end
|
36
34
|
|
37
|
-
describe "#index" do
|
35
|
+
describe "#index" do # rubocop:disable RSpec/MultipleMemoizedHelpers
|
38
36
|
it "renders the page and shows the correct results" do
|
39
37
|
visit movals_path
|
40
38
|
|
41
39
|
expect(page).to have_http_status(:success)
|
42
|
-
expect(
|
40
|
+
expect(page).to have_current_path movals_path, ignore_query: true
|
43
41
|
|
44
42
|
find("input[type=checkbox][value='#{handler_translation.id}']") # Expect to find
|
45
43
|
|
@@ -49,14 +47,14 @@ describe AwesomeTranslations::MovalsController do
|
|
49
47
|
end
|
50
48
|
end
|
51
49
|
|
52
|
-
describe "#create" do
|
50
|
+
describe "#create" do # rubocop:disable RSpec/MultipleMemoizedHelpers
|
53
51
|
it "moves the checked translations to the right path" do
|
54
52
|
visit movals_path
|
55
53
|
|
56
54
|
find("input[type=submit]").click
|
57
55
|
translation_value.reload
|
58
56
|
|
59
|
-
expect(translation_value.file_path).to eq Rails.root.join("config
|
57
|
+
expect(translation_value.file_path).to eq Rails.root.join("config/locales/some/right/path/en.yml").to_s
|
60
58
|
end
|
61
59
|
end
|
62
60
|
end
|
@@ -3,7 +3,7 @@ require "spec_helper"
|
|
3
3
|
describe AwesomeTranslations::Handlers::FileHandler do
|
4
4
|
let(:handler) { AwesomeTranslations::Handlers::FileHandler.new }
|
5
5
|
|
6
|
-
describe "erb stuff" do
|
6
|
+
describe "erb stuff" do # rubocop:disable RSpec/MultipleMemoizedHelpers
|
7
7
|
let(:users_index_group) { handler.groups.find { |group| group.name == "app/views/users/index.html.haml" } }
|
8
8
|
let(:users_index_translations) { users_index_group.translations }
|
9
9
|
let(:users_partial_test_translations) { handler.groups.find { |group| group.name == "app/views/users/_partial_test.html.erb" }.translations }
|
@@ -36,11 +36,11 @@ describe AwesomeTranslations::Handlers::FileHandler do
|
|
36
36
|
|
37
37
|
it "sets the correct translation path" do
|
38
38
|
danish_translation = layout_translations.find { |t| t.key == "layouts.application.danish" }
|
39
|
-
expect(danish_translation.dir).to eq
|
39
|
+
expect(danish_translation.dir).to eq Rails.root.join("config/locales/awesome_translations/layouts/application").to_s
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
describe "library stuff" do
|
43
|
+
describe "library stuff" do # rubocop:disable RSpec/MultipleMemoizedHelpers
|
44
44
|
let(:group) { handler.groups.find { |group| group.name == "app/models/role.rb" } }
|
45
45
|
let(:mailer_group) { handler.groups.find { |group| group.name == "app/mailers/my_mailer.rb" } }
|
46
46
|
let(:subject_translation) { mailer_group.translations.find { |translation| translation.key == "my_mailer.mailer_action.custom_subject" } }
|
@@ -51,7 +51,7 @@ describe AwesomeTranslations::Handlers::FileHandler do
|
|
51
51
|
let(:update_saved_translation) { users_controller_handler.translations.find { |translation| translation.key == "users.user_was_updated" } }
|
52
52
|
|
53
53
|
it "finds translations made with the t method" do
|
54
|
-
expect(admin_translation).
|
54
|
+
expect(admin_translation).not_to eq nil
|
55
55
|
expect(admin_translation.key).to eq "models.role.administrator"
|
56
56
|
expect(admin_translation.dir).to end_with "spec/dummy/config/locales/awesome_translations/models/role"
|
57
57
|
end
|
@@ -64,8 +64,8 @@ describe AwesomeTranslations::Handlers::FileHandler do
|
|
64
64
|
moderator_translation = group.translations.find { |translation| translation.key == "models.role.moderator" }
|
65
65
|
user_translation = group.translations.find { |translation| translation.key == "models.role.user" }
|
66
66
|
|
67
|
-
expect(moderator_translation).
|
68
|
-
expect(user_translation).
|
67
|
+
expect(moderator_translation).not_to eq nil
|
68
|
+
expect(user_translation).not_to eq nil
|
69
69
|
end
|
70
70
|
|
71
71
|
it "finds helpers translations using helper_t" do
|
@@ -73,7 +73,7 @@ describe AwesomeTranslations::Handlers::FileHandler do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
it "finds translations with the controller_t-method" do
|
76
|
-
expect(update_saved_translation).
|
76
|
+
expect(update_saved_translation).not_to eq nil
|
77
77
|
expect(update_saved_translation.key).to eq "users.user_was_updated"
|
78
78
|
expect(update_saved_translation.dir).to end_with "spec/dummy/config/locales/awesome_translations/users"
|
79
79
|
end
|
@@ -93,7 +93,7 @@ describe AwesomeTranslations::Handlers::FileHandler do
|
|
93
93
|
end
|
94
94
|
|
95
95
|
it "sets the correct translation path" do
|
96
|
-
expect(yes_translation.dir).to eq
|
96
|
+
expect(yes_translation.dir).to eq Rails.root.join("config/locales/awesome_translations").to_s
|
97
97
|
end
|
98
98
|
|
99
99
|
it "detects absolute existing direct translations" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe AwesomeTranslations::Handlers::ModelHandler do
|
3
|
+
describe AwesomeTranslations::Handlers::ModelHandler do # rubocop:disable RSpec/MultipleMemoizedHelpers
|
4
4
|
let(:model_handler) { AwesomeTranslations::Handlers::ModelHandler.new }
|
5
5
|
let(:groups) { model_handler.groups.to_a }
|
6
6
|
let(:user_group) { model_handler.groups.detect { |group| group.name == "User" } }
|
@@ -9,11 +9,11 @@ describe AwesomeTranslations::Handlers::ModelHandler do
|
|
9
9
|
let(:role_translation_keys) { role_group.translations.map(&:key).to_a }
|
10
10
|
|
11
11
|
it "#groups" do
|
12
|
-
expect(groups.length).to eq
|
12
|
+
expect(groups.length).to eq 5
|
13
13
|
end
|
14
14
|
|
15
|
-
describe "#translations_for_group" do
|
16
|
-
it "
|
15
|
+
describe "#translations_for_group" do # rubocop:disable RSpec/MultipleMemoizedHelpers
|
16
|
+
it "finds the right number of translations" do
|
17
17
|
expect(user_group.translations.to_a.length).to eq 7
|
18
18
|
end
|
19
19
|
|
@@ -6,7 +6,7 @@ describe AwesomeTranslations::Handlers::ValidationsHandler do
|
|
6
6
|
let(:blank_email_translation) { user_group.translations.find { |translation| translation.key.include? "email.blank" } }
|
7
7
|
|
8
8
|
it "#groups" do
|
9
|
-
expect(validations_handler.groups.to_a.length).to eq
|
9
|
+
expect(validations_handler.groups.to_a.length).to eq 5
|
10
10
|
end
|
11
11
|
|
12
12
|
describe "#translations_for_group" do
|
@@ -19,12 +19,12 @@ describe AwesomeTranslations::Handlers::ValidationsHandler do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it "finds the right directory" do
|
22
|
-
expect(blank_email_translation.dir).to eq
|
22
|
+
expect(blank_email_translation.dir).to eq Rails.root.join("config/locales/awesome_translations/models/user").to_s
|
23
23
|
end
|
24
24
|
|
25
25
|
it "finds confirmation translations" do
|
26
26
|
confirmation_translation = user_group.translations.find { |translation| translation.key.include? "email_confirmation" }
|
27
|
-
expect(confirmation_translation).
|
27
|
+
expect(confirmation_translation).not_to be_blank
|
28
28
|
expect(confirmation_translation.key).to eq "activerecord.errors.models.user.attributes.email_confirmation.confirmation"
|
29
29
|
end
|
30
30
|
end
|
data/spec/handlers_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe AwesomeTranslations::Handlers do
|
4
|
-
it "
|
4
|
+
it "does not include base in list" do
|
5
5
|
AwesomeTranslations::Handlers.list.each do |handler|
|
6
6
|
expect(handler.id.to_s.downcase.include?("base")).to eq false
|
7
7
|
end
|
@@ -6,7 +6,7 @@ describe AwesomeTranslations::CacheDatabaseGenerator do
|
|
6
6
|
let(:db) { cache_database_generator.db }
|
7
7
|
|
8
8
|
before do
|
9
|
-
locales_path = Rails.root.join("config
|
9
|
+
locales_path = Rails.root.join("config/locales")
|
10
10
|
FileUtils.rm_rf(locales_path)
|
11
11
|
Dir.mkdir(locales_path)
|
12
12
|
|
@@ -25,7 +25,7 @@ describe AwesomeTranslations::CacheDatabaseGenerator do
|
|
25
25
|
}
|
26
26
|
}
|
27
27
|
|
28
|
-
File.
|
28
|
+
File.write(fake_path, YAML.dump(translations))
|
29
29
|
end
|
30
30
|
|
31
31
|
it "#init_database" do
|
@@ -41,7 +41,7 @@ describe AwesomeTranslations::CacheDatabaseGenerator do
|
|
41
41
|
.where(translation_keys: {key: "activerecord.attributes.user.id"})
|
42
42
|
.first
|
43
43
|
|
44
|
-
expect(translation).
|
44
|
+
expect(translation).not_to eq nil
|
45
45
|
end
|
46
46
|
|
47
47
|
it "#cache_handler_translations" do
|
@@ -53,7 +53,7 @@ describe AwesomeTranslations::CacheDatabaseGenerator do
|
|
53
53
|
.where(translation_keys: {key: "activerecord.attributes.user.id"})
|
54
54
|
.first
|
55
55
|
|
56
|
-
expect(translation).
|
56
|
+
expect(translation).not_to eq nil
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe AwesomeTranslations::ErbInspector::FileInspector do
|
3
|
+
describe AwesomeTranslations::ErbInspector::FileInspector do # rubocop:disable RSpec/MultipleMemoizedHelpers
|
4
4
|
let(:erb_inspector) do
|
5
5
|
AwesomeTranslations::ErbInspector.new(
|
6
6
|
dirs: [Rails.root.to_s]
|
@@ -15,7 +15,7 @@ describe AwesomeTranslations::ErbInspector::FileInspector do
|
|
15
15
|
let(:user_index_translations) { user_index_inspector.translations.to_a }
|
16
16
|
let(:hello_world_translation) { user_index_translations.find { |translation| translation.key == ".hello_world" } }
|
17
17
|
|
18
|
-
describe "#translations" do
|
18
|
+
describe "#translations" do # rubocop:disable RSpec/MultipleMemoizedHelpers
|
19
19
|
it "finds the right number of translations" do
|
20
20
|
expect(user_index_translations.length).to eq 3
|
21
21
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe AwesomeTranslations::ErbInspector::TranslationInspector do
|
3
|
+
describe AwesomeTranslations::ErbInspector::TranslationInspector do # rubocop:disable RSpec/MultipleMemoizedHelpers
|
4
4
|
let(:erb_inspector) do
|
5
5
|
AwesomeTranslations::ErbInspector.new(
|
6
6
|
dirs: [Rails.root.to_s]
|
@@ -24,7 +24,7 @@ describe AwesomeTranslations::ErbInspector::TranslationInspector do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it "#full_path" do
|
27
|
-
expect(hello_world_translation.full_path).to eq Rails.root.join("app
|
27
|
+
expect(hello_world_translation.full_path).to eq Rails.root.join("app/views/users/index.html.haml").to_s
|
28
28
|
end
|
29
29
|
|
30
30
|
it "#dir" do
|
@@ -11,19 +11,19 @@ describe AwesomeTranslations::ErbInspector do
|
|
11
11
|
let(:file_paths) { files.map(&:file_path) }
|
12
12
|
|
13
13
|
describe "#files" do
|
14
|
-
it "
|
15
|
-
expect(files.length).to eq
|
14
|
+
it "finds the right amount of haml-files" do
|
15
|
+
expect(files.length).to eq 34
|
16
16
|
end
|
17
17
|
|
18
|
-
it "
|
18
|
+
it "finds haml-files" do
|
19
19
|
expect(file_paths).to include "app/views/users/index.html.haml"
|
20
20
|
end
|
21
21
|
|
22
|
-
it "
|
22
|
+
it "finds js-files" do
|
23
23
|
expect(file_paths).to include "app/assets/javascripts/translations.js"
|
24
24
|
end
|
25
25
|
|
26
|
-
it "
|
26
|
+
it "finds erb-files" do
|
27
27
|
expect(file_paths).to include "app/views/users/show.html.erb"
|
28
28
|
end
|
29
29
|
end
|
@@ -2,15 +2,15 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe AwesomeTranslations::ModelInspector do
|
4
4
|
let(:user_inspector) { AwesomeTranslations::ModelInspector.model_classes.find { |model_inspector| model_inspector.clazz == User } }
|
5
|
-
let(:model_classes) { AwesomeTranslations::ModelInspector.model_classes.map(&:clazz).
|
5
|
+
let(:model_classes) { AwesomeTranslations::ModelInspector.model_classes.map(&:clazz).reject { |clazz| clazz.name.end_with?("::Translation") } }
|
6
6
|
|
7
7
|
it "#model_classes" do
|
8
|
-
expect(model_classes.to_a.
|
8
|
+
expect(model_classes.to_a.sort_by(&:name)).to eq [ApplicationRecord, Role, User]
|
9
9
|
end
|
10
10
|
|
11
11
|
it "#engines" do
|
12
12
|
expected = [ActionView::Railtie, AwesomeTranslations::Engine, MoneyRails::Engine]
|
13
|
-
expect(AwesomeTranslations::ModelInspector.engines.map(&:class).
|
13
|
+
expect(AwesomeTranslations::ModelInspector.engines.map(&:class).sort_by(&:name)).to eq expected
|
14
14
|
end
|
15
15
|
|
16
16
|
it "#class_key" do
|
@@ -34,6 +34,6 @@ describe AwesomeTranslations::ModelInspector do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
it "#attributes" do
|
37
|
-
expect(user_inspector.attributes.map(&:name).to_a).to eq %w
|
37
|
+
expect(user_inspector.attributes.map(&:name).to_a).to eq %w[id email password age]
|
38
38
|
end
|
39
39
|
end
|