has_constant 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/has_constant.gemspec +1 -1
- data/lib/has_constant/orm/mongoid.rb +1 -1
- data/test/unit/orm/mongoid_test.rb +6 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.7
|
data/has_constant.gemspec
CHANGED
@@ -16,7 +16,7 @@ module HasConstant
|
|
16
16
|
end
|
17
17
|
|
18
18
|
module ClassMethods
|
19
|
-
def has_constant( name, values, options = {} )
|
19
|
+
def has_constant( name, values = lambda { I18n.t(name) }, options = {} )
|
20
20
|
super(name, values, options)
|
21
21
|
|
22
22
|
singular = (options[:accessor] || name.to_s.singularize).to_s
|
@@ -36,6 +36,12 @@ class MongoidTest < Test::Unit::TestCase
|
|
36
36
|
assert MongoUserWithout.fields.map(&:first).include?('sal')
|
37
37
|
end
|
38
38
|
|
39
|
+
should 'default values to translated values list' do
|
40
|
+
I18n.stubs(:t).returns(['a', 'b'])
|
41
|
+
MongoUserWithout.has_constant :titles
|
42
|
+
assert_equal ['a', 'b'], MongoUserWithout.titles
|
43
|
+
end
|
44
|
+
|
39
45
|
should 'add index when index option is supplied' do
|
40
46
|
MongoUserWithout.has_constant :salutations, ['Mr', 'Mrs'], :index => true
|
41
47
|
MongoUserWithout.create_indexes
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_constant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 7
|
10
|
+
version: 0.4.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- mattbeedle
|