awesome_translations 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/awesome_translations/groups.css.scss +4 -0
- data/app/views/awesome_translations/groups/show.html.haml +1 -2
- data/lib/awesome_translations.rb +1 -1
- data/lib/awesome_translations/erb_inspector/translation_inspector.rb +4 -0
- data/lib/awesome_translations/handlers/erb_handler.rb +1 -0
- data/lib/awesome_translations/handlers/global_handler.rb +1 -1
- data/lib/awesome_translations/handlers/model_handler.rb +5 -5
- data/lib/awesome_translations/model_inspector.rb +33 -63
- data/lib/awesome_translations/model_inspector/attribute.rb +4 -4
- data/lib/awesome_translations/version.rb +1 -1
- data/spec/dummy/config/locales/translations.yml +8 -0
- data/spec/dummy/log/development.log +1 -0
- data/spec/dummy/log/test.log +3282 -0
- data/spec/dummy/tmp/cache/assets/test/sass/79bc6a1530be4e47bb2bf0dda4943bc0e439789f/application.css.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/79bc6a1530be4e47bb2bf0dda4943bc0e439789f/groups.css.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/50b9bcf05a8718d9cb5b99276f154ea9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6db8498274efddac6691248cc9afe855 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/bd49bb0a6f5dfd284a750fb9cab40d85 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c39fce5fa19b758734af29527d4185ca +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/cb595904fcf7acdedf2b95571442fc59 +0 -0
- data/spec/lib/model_inspector/attribute_spec.rb +18 -0
- data/spec/lib/model_inspector_spec.rb +38 -0
- metadata +8 -26
- data/spec/dummy/config/locales/awesome_translations/app/views/users/da.yml +0 -5
- data/spec/dummy/config/locales/awesome_translations/app/views/users/de.yml +0 -5
- data/spec/dummy/config/locales/awesome_translations/app/views/users/en.yml +0 -5
- data/spec/dummy/config/locales/awesome_translations/da.yml +0 -4
- data/spec/dummy/config/locales/awesome_translations/de.yml +0 -4
- data/spec/dummy/config/locales/awesome_translations/en.yml +0 -4
- data/spec/dummy/config/locales/awesome_translations/models/role/da.yml +0 -6
- data/spec/dummy/config/locales/awesome_translations/models/role/de.yml +0 -6
- data/spec/dummy/config/locales/awesome_translations/models/role/en.yml +0 -6
- data/spec/dummy/config/locales/awesome_translations/models/user/da.yml +0 -12
- data/spec/dummy/config/locales/awesome_translations/models/user/de.yml +0 -12
- data/spec/dummy/config/locales/awesome_translations/models/user/en.yml +0 -12
Binary file
|
data/spec/dummy/tmp/cache/assets/test/sass/79bc6a1530be4e47bb2bf0dda4943bc0e439789f/groups.css.scssc
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe AwesomeTranslations::ModelInspector::Attribute do
|
4
|
+
let(:user_inspector) { AwesomeTranslations::ModelInspector.model_classes.select { |model_inspector| model_inspector.clazz == User }.first }
|
5
|
+
let(:email_attr) { user_inspector.attributes.select { |attribute| attribute.name == "email" }.first }
|
6
|
+
|
7
|
+
it "#i18n_key" do
|
8
|
+
email_attr.i18n_key.should eq "activerecord.attributes.user.email"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "#name" do
|
12
|
+
email_attr.name.should eq "email"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "#model_inspector" do
|
16
|
+
email_attr.model_inspector.clazz.should eq User
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe AwesomeTranslations::ModelInspector do
|
4
|
+
let(:user_inspector) { AwesomeTranslations::ModelInspector.model_classes.select { |model_inspector| model_inspector.clazz == User }.first }
|
5
|
+
let(:model_classes) { AwesomeTranslations::ModelInspector.model_classes.map(&:clazz) }
|
6
|
+
|
7
|
+
it "#model_classes" do
|
8
|
+
model_classes.to_a.sort { |class1, class2| class1.name <=> class2.name }.should eq [Role, User]
|
9
|
+
end
|
10
|
+
|
11
|
+
it "#engines" do
|
12
|
+
AwesomeTranslations::ModelInspector.engines.map(&:class).should eq [AwesomeTranslations::Engine, Jquery::Rails::Engine]
|
13
|
+
end
|
14
|
+
|
15
|
+
it "#class_key" do
|
16
|
+
user_inspector.class_key.should eq "activerecord.models.user"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "#class_key_one" do
|
20
|
+
user_inspector.class_key_one.should eq "activerecord.models.user.one"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "#class_key_other" do
|
24
|
+
user_inspector.class_key_other.should eq "activerecord.models.user.other"
|
25
|
+
end
|
26
|
+
|
27
|
+
it "#attribute_key" do
|
28
|
+
user_inspector.attribute_key("first_name").should eq "activerecord.attributes.user.first_name"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "#snake_name" do
|
32
|
+
user_inspector.snake_name.should eq "user"
|
33
|
+
end
|
34
|
+
|
35
|
+
it "#attributes" do
|
36
|
+
user_inspector.attributes.map(&:name).to_a.should eq ["id", "email", "password", "age"]
|
37
|
+
end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awesome_translations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kasper Johansen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -258,19 +258,8 @@ files:
|
|
258
258
|
- spec/dummy/config/initializers/secret_token.rb
|
259
259
|
- spec/dummy/config/initializers/session_store.rb
|
260
260
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
261
|
-
- spec/dummy/config/locales/awesome_translations/app/views/users/da.yml
|
262
|
-
- spec/dummy/config/locales/awesome_translations/app/views/users/de.yml
|
263
|
-
- spec/dummy/config/locales/awesome_translations/app/views/users/en.yml
|
264
|
-
- spec/dummy/config/locales/awesome_translations/da.yml
|
265
|
-
- spec/dummy/config/locales/awesome_translations/de.yml
|
266
|
-
- spec/dummy/config/locales/awesome_translations/en.yml
|
267
|
-
- spec/dummy/config/locales/awesome_translations/models/role/da.yml
|
268
|
-
- spec/dummy/config/locales/awesome_translations/models/role/de.yml
|
269
|
-
- spec/dummy/config/locales/awesome_translations/models/role/en.yml
|
270
|
-
- spec/dummy/config/locales/awesome_translations/models/user/da.yml
|
271
|
-
- spec/dummy/config/locales/awesome_translations/models/user/de.yml
|
272
|
-
- spec/dummy/config/locales/awesome_translations/models/user/en.yml
|
273
261
|
- spec/dummy/config/locales/en.yml
|
262
|
+
- spec/dummy/config/locales/translations.yml
|
274
263
|
- spec/dummy/config/routes.rb
|
275
264
|
- spec/dummy/db/development.sqlite3
|
276
265
|
- spec/dummy/db/migrate/20141018081559_create_users.rb
|
@@ -348,6 +337,8 @@ files:
|
|
348
337
|
- spec/lib/erb_inspector/file_inspector_spec.rb
|
349
338
|
- spec/lib/erb_inspector/translation_inspector_spec.rb
|
350
339
|
- spec/lib/erb_inspector_spec.rb
|
340
|
+
- spec/lib/model_inspector/attribute_spec.rb
|
341
|
+
- spec/lib/model_inspector_spec.rb
|
351
342
|
- spec/models/awesome_translations/handler_spec.rb
|
352
343
|
- spec/models/awesome_translations/translated_value_spec.rb
|
353
344
|
- spec/spec_helper.rb
|
@@ -375,6 +366,8 @@ signing_key:
|
|
375
366
|
specification_version: 4
|
376
367
|
summary: Semi-automatic maintenance of most translations in a Rails app.
|
377
368
|
test_files:
|
369
|
+
- spec/lib/model_inspector/attribute_spec.rb
|
370
|
+
- spec/lib/model_inspector_spec.rb
|
378
371
|
- spec/lib/erb_inspector/file_inspector_spec.rb
|
379
372
|
- spec/lib/erb_inspector/translation_inspector_spec.rb
|
380
373
|
- spec/lib/erb_inspector_spec.rb
|
@@ -487,18 +480,7 @@ test_files:
|
|
487
480
|
- spec/dummy/config/application.rb
|
488
481
|
- spec/dummy/config/environment.rb
|
489
482
|
- spec/dummy/config/boot.rb
|
490
|
-
- spec/dummy/config/locales/
|
491
|
-
- spec/dummy/config/locales/awesome_translations/app/views/users/de.yml
|
492
|
-
- spec/dummy/config/locales/awesome_translations/app/views/users/en.yml
|
493
|
-
- spec/dummy/config/locales/awesome_translations/da.yml
|
494
|
-
- spec/dummy/config/locales/awesome_translations/models/role/da.yml
|
495
|
-
- spec/dummy/config/locales/awesome_translations/models/role/de.yml
|
496
|
-
- spec/dummy/config/locales/awesome_translations/models/role/en.yml
|
497
|
-
- spec/dummy/config/locales/awesome_translations/models/user/da.yml
|
498
|
-
- spec/dummy/config/locales/awesome_translations/models/user/de.yml
|
499
|
-
- spec/dummy/config/locales/awesome_translations/models/user/en.yml
|
500
|
-
- spec/dummy/config/locales/awesome_translations/de.yml
|
501
|
-
- spec/dummy/config/locales/awesome_translations/en.yml
|
483
|
+
- spec/dummy/config/locales/translations.yml
|
502
484
|
- spec/dummy/config/locales/en.yml
|
503
485
|
- spec/dummy/config/database.yml
|
504
486
|
- spec/dummy/config/routes.rb
|