globalize2 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/README.textile +27 -143
- data/VERSION +1 -1
- data/generators/templates/db_backend_migration.rb +3 -3
- data/globalize2.gemspec +30 -49
- data/init.rb +1 -8
- data/lib/globalize.rb +15 -0
- data/lib/globalize/active_record.rb +195 -0
- data/lib/globalize/active_record/adapter.rb +80 -0
- data/lib/globalize/active_record/attributes.rb +25 -0
- data/lib/globalize/active_record/migration.rb +40 -0
- data/lib/{globalize/i18n → i18n}/missing_translations_log_handler.rb +8 -8
- data/lib/{globalize/i18n → i18n}/missing_translations_raise_handler.rb +3 -5
- data/test/active_record/fallbacks_test.rb +102 -0
- data/test/{model/active_record → active_record}/migration_test.rb +21 -26
- data/test/{model/active_record → active_record}/sti_translated_test.rb +4 -30
- data/test/active_record/translates_test.rb +87 -0
- data/test/active_record/translation_class_test.rb +30 -0
- data/test/active_record/validation_tests.rb +75 -0
- data/test/active_record_test.rb +451 -0
- data/test/data/models.rb +16 -0
- data/test/data/schema.rb +23 -7
- data/test/i18n/missing_translations_test.rb +6 -6
- data/test/test_helper.rb +55 -15
- metadata +33 -46
- data/lib/globalize/backend/chain.rb +0 -102
- data/lib/globalize/backend/pluralizing.rb +0 -37
- data/lib/globalize/backend/static.rb +0 -61
- data/lib/globalize/load_path.rb +0 -63
- data/lib/globalize/locale/fallbacks.rb +0 -63
- data/lib/globalize/locale/language_tag.rb +0 -81
- data/lib/globalize/model/active_record.rb +0 -56
- data/lib/globalize/model/active_record/adapter.rb +0 -100
- data/lib/globalize/model/active_record/translated.rb +0 -174
- data/lib/globalize/translation.rb +0 -32
- data/lib/locale/root.yml +0 -3
- data/lib/rails_edge_load_path_patch.rb +0 -40
- data/notes.textile +0 -51
- data/test/backends/chained_test.rb +0 -175
- data/test/backends/pluralizing_test.rb +0 -63
- data/test/backends/static_test.rb +0 -147
- data/test/data/locale/all.yml +0 -2
- data/test/data/locale/de-DE.yml +0 -2
- data/test/data/locale/en-US.yml +0 -2
- data/test/data/locale/en-US/module.yml +0 -2
- data/test/data/locale/fi-FI/module.yml +0 -2
- data/test/data/locale/root.yml +0 -0
- data/test/load_path_test.rb +0 -49
- data/test/locale/fallbacks_test.rb +0 -154
- data/test/locale/language_tag_test.rb +0 -130
- data/test/model/active_record/translated_test.rb +0 -487
- data/test/translation_test.rb +0 -54
data/test/translation_test.rb
DELETED
@@ -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
|