gettext_column_mapping 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.6
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gettext_column_mapping}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["hallelujah"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-10-28}
|
13
13
|
s.description = %q{Translate your database columns with gettext}
|
14
14
|
s.email = %q{hery@rails-royce.org}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -45,8 +45,12 @@ module GettextColumnMapping
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def extend_active_record
|
48
|
-
ActiveRecord::Base.
|
49
|
-
|
48
|
+
unless ActiveRecord::Base.included_modules.include?(GettextColumnMapping::Backends::Base)
|
49
|
+
ActiveRecord::Base.send(:include,GettextColumnMapping::Backends::Base)
|
50
|
+
end
|
51
|
+
unless ActiveRecord::Base.included_modules.include?(config.backend_class.constantize)
|
52
|
+
ActiveRecord::Base.send(:include, config.backend_class.constantize)
|
53
|
+
end
|
50
54
|
if config.use_parent_level
|
51
55
|
require 'gettext_column_mapping/parent_level'
|
52
56
|
GettextColumnMapping::ParentLevel.load_config
|
@@ -2,6 +2,10 @@
|
|
2
2
|
require 'test_helper'
|
3
3
|
class GettextColumnMappingTest < ActiveSupport::TestCase
|
4
4
|
|
5
|
+
def setup
|
6
|
+
@config_file = File.join($gettext_column_mapping_root, 'config/column_mapping.yml')
|
7
|
+
end
|
8
|
+
|
5
9
|
def test_config
|
6
10
|
assert_instance_of ActiveSupport::OrderedOptions, GettextColumnMapping.config
|
7
11
|
assert_instance_of GettextColumnMapping::Mapper, GettextColumnMapping.mapper
|
@@ -15,10 +19,30 @@ class GettextColumnMappingTest < ActiveSupport::TestCase
|
|
15
19
|
assert_equal "Model", GettextColumnMapping.config.model_prefix
|
16
20
|
assert_equal "Data", GettextColumnMapping.config.data_prefix
|
17
21
|
|
18
|
-
GettextColumnMapping.config.config_file =
|
22
|
+
GettextColumnMapping.config.config_file = @config_file
|
19
23
|
assert_not_nil GettextColumnMapping.config.config_file
|
20
24
|
|
21
25
|
GettextColumnMapping::Initializer.run
|
22
26
|
end
|
23
27
|
|
28
|
+
|
29
|
+
def test_rerun
|
30
|
+
GettextColumnMapping.config.config_gile = @config_file
|
31
|
+
|
32
|
+
GettextColumnMapping::Initializer.run
|
33
|
+
assert_nothing_raised do
|
34
|
+
Utilisateur.last
|
35
|
+
end
|
36
|
+
|
37
|
+
# Emulating Rails unload / reload
|
38
|
+
# Todo use ActiveSupport::Dependencies .... but i am too lazy doing that :)
|
39
|
+
Object.send(:remove_const, :Utilisateur)
|
40
|
+
load File.join($gettext_column_mapping_root,'models/utilisateur.rb')
|
41
|
+
GettextColumnMapping::Initializer.run
|
42
|
+
assert_nothing_raised do
|
43
|
+
Utilisateur.last
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
24
48
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 6
|
9
|
+
version: 0.2.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- hallelujah
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-10-28 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|