globalize2 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/.gitignore +2 -1
  2. data/README.textile +27 -143
  3. data/VERSION +1 -1
  4. data/generators/templates/db_backend_migration.rb +3 -3
  5. data/globalize2.gemspec +30 -49
  6. data/init.rb +1 -8
  7. data/lib/globalize.rb +15 -0
  8. data/lib/globalize/active_record.rb +195 -0
  9. data/lib/globalize/active_record/adapter.rb +80 -0
  10. data/lib/globalize/active_record/attributes.rb +25 -0
  11. data/lib/globalize/active_record/migration.rb +40 -0
  12. data/lib/{globalize/i18n → i18n}/missing_translations_log_handler.rb +8 -8
  13. data/lib/{globalize/i18n → i18n}/missing_translations_raise_handler.rb +3 -5
  14. data/test/active_record/fallbacks_test.rb +102 -0
  15. data/test/{model/active_record → active_record}/migration_test.rb +21 -26
  16. data/test/{model/active_record → active_record}/sti_translated_test.rb +4 -30
  17. data/test/active_record/translates_test.rb +87 -0
  18. data/test/active_record/translation_class_test.rb +30 -0
  19. data/test/active_record/validation_tests.rb +75 -0
  20. data/test/active_record_test.rb +451 -0
  21. data/test/data/models.rb +16 -0
  22. data/test/data/schema.rb +23 -7
  23. data/test/i18n/missing_translations_test.rb +6 -6
  24. data/test/test_helper.rb +55 -15
  25. metadata +33 -46
  26. data/lib/globalize/backend/chain.rb +0 -102
  27. data/lib/globalize/backend/pluralizing.rb +0 -37
  28. data/lib/globalize/backend/static.rb +0 -61
  29. data/lib/globalize/load_path.rb +0 -63
  30. data/lib/globalize/locale/fallbacks.rb +0 -63
  31. data/lib/globalize/locale/language_tag.rb +0 -81
  32. data/lib/globalize/model/active_record.rb +0 -56
  33. data/lib/globalize/model/active_record/adapter.rb +0 -100
  34. data/lib/globalize/model/active_record/translated.rb +0 -174
  35. data/lib/globalize/translation.rb +0 -32
  36. data/lib/locale/root.yml +0 -3
  37. data/lib/rails_edge_load_path_patch.rb +0 -40
  38. data/notes.textile +0 -51
  39. data/test/backends/chained_test.rb +0 -175
  40. data/test/backends/pluralizing_test.rb +0 -63
  41. data/test/backends/static_test.rb +0 -147
  42. data/test/data/locale/all.yml +0 -2
  43. data/test/data/locale/de-DE.yml +0 -2
  44. data/test/data/locale/en-US.yml +0 -2
  45. data/test/data/locale/en-US/module.yml +0 -2
  46. data/test/data/locale/fi-FI/module.yml +0 -2
  47. data/test/data/locale/root.yml +0 -0
  48. data/test/load_path_test.rb +0 -49
  49. data/test/locale/fallbacks_test.rb +0 -154
  50. data/test/locale/language_tag_test.rb +0 -130
  51. data/test/model/active_record/translated_test.rb +0 -487
  52. data/test/translation_test.rb +0 -54
@@ -1,54 +0,0 @@
1
- require File.join( File.dirname(__FILE__), 'test_helper' )
2
- require 'globalize/translation'
3
-
4
- class TranslationTest < ActiveSupport::TestCase
5
- include Globalize
6
-
7
- def setup
8
- @translation = Translation::Static.new 'foo', :locale => :'en-US'
9
- end
10
-
11
- test "responds to fallback?" do
12
- assert @translation.respond_to?( :fallback? )
13
- end
14
-
15
- test "returns true when :locale and :requested_locale are not equal" do
16
- @translation.requested_locale = :'de-DE'
17
- assert @translation.fallback?
18
- end
19
-
20
- test "returns false when :locale and :requested_locale are equal" do
21
- @translation.requested_locale = :'en-US'
22
- assert !@translation.fallback?
23
- end
24
-
25
- test "has the attribute :locale" do
26
- assert @translation.respond_to?( :locale )
27
- end
28
-
29
- test "has the attribute :requested_locale" do
30
- assert @translation.respond_to?( :requested_locale )
31
- end
32
-
33
- test "has the attribute :options" do
34
- assert @translation.respond_to?( :options )
35
- end
36
-
37
- test "has the attribute :plural_key" do
38
- assert @translation.respond_to?( :plural_key )
39
- end
40
-
41
- test "has the attribute :original" do
42
- assert @translation.respond_to?( :original )
43
- end
44
-
45
- test "Translation::Attribute has the attribute :locale" do
46
- translation = Translation::Attribute.new 'foo'
47
- assert translation.respond_to?( :locale )
48
- end
49
-
50
- test "Translation::Attribute has the attribute :requested_locale" do
51
- translation = Translation::Attribute.new 'foo'
52
- assert translation.respond_to?( :requested_locale )
53
- end
54
- end