awesome_translations 0.0.58 → 0.0.59
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +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 +4 -1
- 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.rb +1 -1
- data/lib/awesome_translations/cache_database_generator.rb +2 -2
- data/lib/awesome_translations/cache_database_generator/group.rb +1 -1
- data/lib/awesome_translations/cache_database_generator/handler_translation.rb +2 -0
- data/lib/awesome_translations/config.rb +3 -3
- data/lib/awesome_translations/engine.rb +0 -4
- data/lib/awesome_translations/erb_inspector.rb +1 -0
- data/lib/awesome_translations/global_translator.rb +9 -23
- data/lib/awesome_translations/handlers.rb +1 -0
- 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 +1 -1
- data/lib/awesome_translations/model_inspector.rb +8 -5
- data/lib/awesome_translations/translation_migrator.rb +1 -1
- data/lib/awesome_translations/version.rb +1 -1
- data/lib/tasks/awesome_translations_tasks.rake +1 -1
- data/spec/controllers/groups_controller_spec.rb +5 -5
- data/spec/controllers/handlers_controller_spec.rb +1 -1
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/app/assets/config/manifest.js +3 -0
- 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 +1 -1
- 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/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 +79 -0
- data/spec/dummy/log/test.log +1910 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/-o/-oFcVYifzG9CN5_s1hdowmNEkOY9nMkeYSN1wi8jK9k.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/0-/0-1MiAUTzmkJ19QVNrjLw3HNw2Cu4279NlmUcUv0lnU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/1R/1RUC_iIhcuw4UJeKhOqLFN8264iDG1axfV3uVyPv0wg.cache +1 -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/5U/5U8HCshUrO4uN8GT_N4K-MtrOiG-4cWdiepxNuvIjAw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/6y/6y2qhWDpnSTpsocv2lVSclXFxpCRU78VjU0sy2FGrWc.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/8p/8pzZq0f95KJrJtOmdr_19FPTeyHX3zMnw6Epsu3T_6c.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/8x/8xTH_c2XZMdMXFHSjlUQD4pTAYTNqnrTrjDURs8jlFI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/AC/ACPB0Rs6DHQU6RIjgT-BODcpFLYUC_sPb9CvJGvg6ro.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/AJ/AJ3ShPZKDgRfZy8niYD_tk4u0Ur5Y6oC85d-0oXgc3w.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/AU/AUklJJKwz_vqy3TUoKDyB5ounU8pAqv6-_tES3aPoZ8.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/CP/CPuNl6dzr9CzS_s74a_K5yuTPy1ch0_-ehTglX1zaEE.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/CV/CVBUxdOogbkuDTae7pFS7i66HyowCSP07Os91LwRmHY.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/Do/Do83AoOat5W-c1g7piDGy2GMmffsY6JY0Qfuh5PY3GM.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/ER/EREGJziB-yMwOXwJeDrZ6Tie8HJU33_JSMXwzy7JsG4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Fc/FcJbnT7qHcLV5Zp_u7NV_yomOI9o9yG-F00bV0Gzm_Q.cache +1 -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/O6/O6K_G66TEscDh-j-DIIwfAqivslF8smPlcj9dJCvrh4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/O6/O6zA2BS4Y306Mmq4fuRnINim1pUdJgZvv_GJkGYXFxw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Ql/QlbxNnG-vjEDZ8GyOJHhNZY-GeHvDiuCj8IATbE9C8w.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/S5/S57ilTeMjIW4abqhMiTmEi59zjS9uSXp697eO1D1Wjo.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/S8/S86Mp1PRbiyejdN42WqWkRnoIoKRl4WoqM5lKxqw1w4.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/TC/TCAloV783-iAe72Q34cyIRfs-xPaNfSgPcPF2dl-zYI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/Xn/Xn4epb06guWXnirWNYPta7ddzOkxd1aVDzRMoXp8pjM.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/aa/aaoYFMRQGOYTpfFXf34S0CVVWaAJUx6s8QsSHm476OQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/cK/cK9VEAGHFBzTxd0ICAK2Fv9RWWgiv9I6347by_BYm1w.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/gc/gcjjMGVBrPIbM3oh-VsmXt-W8kWTs2Hc0sM2r5hicgQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/hc/hc75Wwlo1W1FF6zeSSelZ-DXn-n6YkTrvq3_yoXpydw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/iF/iFAZApKjMydtC8Y6hvIXTy-zC2cfmbTrsYlU62u8sJU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/iR/iRIYdMKKwG2D6Tnj-0pGybHLEINmWZ8211nkI700-0Y.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/l2/l2s6YvBxO6tXxM01zv13Dv6jpXaksukCd31VGPl6vPI.cache +1 -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/p7/p70iWC7uyeRLwIEniw-3RltmTZ-lz45IJdePewoXyHY.cache +0 -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/qZ/qZ6ZFXF-wqwyHA2DvJW0tnnFPW-sRmoNY7ysyNfUdi0.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/rH/rH2d5ogZr608pUvHYHKRlqMZTk7BNi8Qp5nL1PLrir8.cache +0 -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/sH/sHqNaY2cQIVvwCv9thQRcI9KaeVjzBt9-dJ8mKnCKMk.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/xk/xkvAEoJDntdxUR56voDrW44MZ8Cx6i9WXQXrLDh2A_w.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/za/zaxpzmSeETtWCbb5X2jLBDtr4Ei16ZUatImF5HE6Mpo.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v4.0.0/zh/zhMgApDdWwFGN9H6KcXRKPtCaQtDHW91V9n3vt_EhoA.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 +1 -1
- data/spec/features/duplicates_spec.rb +4 -4
- data/spec/features/movals_spec.rb +4 -4
- data/spec/handlers/file_handler_spec.rb +6 -6
- data/spec/handlers/model_handler_spec.rb +2 -2
- data/spec/handlers/validations_handler_spec.rb +3 -3
- data/spec/handlers_spec.rb +1 -1
- data/spec/lib/cache_database_generator_spec.rb +3 -3
- data/spec/lib/erb_inspector/translation_inspector_spec.rb +1 -1
- 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 +2 -2
- data/spec/models/awesome_translations/handler_spec.rb +1 -1
- data/spec/models/awesome_translations/translation_spec.rb +7 -2
- data/spec/spec_helper.rb +8 -6
- metadata +179 -93
- data/config/initializers/simple_form_ransack.rb +0 -1
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�/home/dev/Development/awesome_translations/app/assets/javascripts/awesome_translations/application.js?type=application/javascript&pipeline=self&id=836eb8330b66cdd204423be004c28e7d27f43d55bdbba1cd7e7b7b8a9af7606c:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/config/manifest.js?type=application/javascript&pipeline=self&id=0b1d8ce9e8e070fb81e6bbbc472f4d8ca9acd88c5e7d6671d824f0cd44cb8eca:ET
|
@@ -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
|
@@ -0,0 +1 @@
|
|
1
|
+
"%�ku9FJʚ�$M���=s���:�BwbՈ%��-�
|
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
|
+
"%+f����5���N�E�Ȼ�����@��<"���
|
@@ -0,0 +1 @@
|
|
1
|
+
"%��Rm�v�S3.��O�L���ڹc�ƕq�=_j�
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=713288aeaf1dda004a156cbfabd716ca1f0466e69cccd225c76b82aba22f5cb7:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
I"}app/assets/config/manifest.js?type=application/javascript&id=3e9ac213b75397c79a74deb11d45ad06e0fab75f09639d527e14c59bfd26f2c3:ET
|
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=f0e531dbca4559a1e44c4f91ed28b1f1256aff3acc681058f963dbb4e56c1452:ET
|
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,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
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�/home/dev/Development/awesome_translations/app/assets/stylesheets/awesome_translations/application.scss?type=text/css&id=564ffe7aec85c2274ac659bc85b7851e29b93bc133d6b44f77049c331ccf5c77:ET
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�/home/dev/Development/awesome_translations/app/assets/javascripts/awesome_translations/application.js?type=application/javascript&id=2308036dab6fc908b984846c9b1a5ef248a6d928e2e83162e1ce71c65ee44bac:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/javascripts/translations.js?type=application/javascript&id=657004a1fb126b8bac129e11702fd3bf4819d6e774fd16fbb2b2f957c1262bc8:ET
|
@@ -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=c28becc7e58c2e9de0a24141d146e4d484176f82c6ff6f4212bc2145e4bc2f03: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
|
@@ -0,0 +1 @@
|
|
1
|
+
"%�=��=Z@��ȖV'Q��0߅ch9xJ��|K
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/javascripts/application.js?type=application/javascript&id=de2f26650eb29bea34b84c8af2bd000d5d9843448b82cde72d7648b70e88c7cc:ET
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
"%*��}�yB?x��{w�KBq����5=��
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/javascripts/translations.js?type=application/javascript&pipeline=self&id=20851beb24554f2d086f4b2f46089e554085bee714c9c3609fad86f4de8e6350:ET
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
"%��B�����șo�$'�A�d��L���xR�U
|
@@ -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
|
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"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
|
+
"%�ku9FJʚ�$M���=s���:�BwbՈ%��-�
|
Binary file
|
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
|
+
"%��B�����șo�$'�A�d��L���xR�U
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=b693e595a5dd6a8e2912f88f33a68e74648da81647fd6df7b52b41cc46ce12f2:ET
|
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
|
{
|
@@ -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
|
@@ -40,7 +40,7 @@ describe AwesomeTranslations::DuplicatesController do
|
|
40
40
|
visit duplicates_path
|
41
41
|
|
42
42
|
expect(page).to have_http_status(:success)
|
43
|
-
expect(
|
43
|
+
expect(page).to have_current_path duplicates_path, ignore_query: true
|
44
44
|
|
45
45
|
find("input[type=checkbox][name='d[#{translation_value_duplicate.id}]']")
|
46
46
|
|
@@ -4,13 +4,13 @@ describe AwesomeTranslations::MovalsController 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/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" }
|
@@ -39,7 +39,7 @@ describe AwesomeTranslations::MovalsController do
|
|
39
39
|
visit movals_path
|
40
40
|
|
41
41
|
expect(page).to have_http_status(:success)
|
42
|
-
expect(
|
42
|
+
expect(page).to have_current_path movals_path, ignore_query: true
|
43
43
|
|
44
44
|
find("input[type=checkbox][value='#{handler_translation.id}']") # Expect to find
|
45
45
|
|
@@ -56,7 +56,7 @@ describe AwesomeTranslations::MovalsController do
|
|
56
56
|
find("input[type=submit]").click
|
57
57
|
translation_value.reload
|
58
58
|
|
59
|
-
expect(translation_value.file_path).to eq Rails.root.join("config
|
59
|
+
expect(translation_value.file_path).to eq Rails.root.join("config/locales/some/right/path/en.yml").to_s
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
@@ -36,7 +36,7 @@ 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
|
|
@@ -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
|
@@ -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
15
|
describe "#translations_for_group" do
|
16
|
-
it "
|
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
|
|
@@ -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
|
@@ -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
|