File tree Expand file tree Collapse file tree 4 files changed +14
-14
lines changed Expand file tree Collapse file tree 4 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ module Fields
1616 Boolean = Mongoid ::Boolean
1717
1818 # @deprecated
19- TYPE_MAPPINGS = ::Mongoid ::Fields ::FieldTypes ::DEFAULT_MAPPING
19+ TYPE_MAPPINGS = ::Mongoid ::Fields ::FieldTypes ::DEFAULT_ALIASES
2020
2121 # Constant for all names of the _id field in a document.
2222 #
Original file line number Diff line number Diff line change @@ -9,10 +9,10 @@ module Fields
99 # @api private
1010 module FieldTypes
1111
12- # The default mapping of field type symbol to class .
12+ # The default mapping of field type symbol/string aliases to classes .
1313 #
1414 # @api private
15- DEFAULT_MAPPING = {
15+ DEFAULT_ALIASES = {
1616 array : Array ,
1717 big_decimal : BigDecimal ,
1818 binary : BSON ::Binary ,
@@ -67,7 +67,7 @@ def define(type, klass)
6767 #
6868 # @return [ ActiveSupport::HashWithIndifferentAccess<Symbol, Class> ] The memoized field mapping.
6969 def mapping
70- @mapping ||= DEFAULT_MAPPING . dup
70+ @mapping ||= DEFAULT_ALIASES . dup
7171 end
7272
7373 private
Original file line number Diff line number Diff line change 55describe Mongoid ::Fields ::FieldTypes do
66
77 around do |example |
8- described_class . instance_variable_set ( :@mapping , described_class ::DEFAULT_MAPPING . dup )
8+ described_class . instance_variable_set ( :@mapping , described_class ::DEFAULT_ALIASES . dup )
99 example . run
10- described_class . instance_variable_set ( :@mapping , described_class ::DEFAULT_MAPPING . dup )
10+ described_class . instance_variable_set ( :@mapping , described_class ::DEFAULT_ALIASES . dup )
1111 end
1212
1313 describe '.get' do
103103 expect ( described_class . get ( :integer ) ) . to eq String
104104 end
105105
106- it 'does not alter the DEFAULT_MAPPING constant' do
106+ it 'does not alter the DEFAULT_ALIASES constant' do
107107 described_class . define ( :integer , String )
108- expect ( described_class ::DEFAULT_MAPPING [ :integer ] ) . to eq Integer
108+ expect ( described_class ::DEFAULT_ALIASES [ :integer ] ) . to eq Integer
109109 end
110110 end
111111
123123 expect ( described_class . get ( :integer ) ) . to eq nil
124124 end
125125
126- it 'does not alter the DEFAULT_MAPPING constant' do
126+ it 'does not alter the DEFAULT_ALIASES constant' do
127127 described_class . delete ( :integer )
128- expect ( described_class ::DEFAULT_MAPPING [ :integer ] ) . to eq Integer
128+ expect ( described_class ::DEFAULT_ALIASES [ :integer ] ) . to eq Integer
129129 end
130130 end
131131
132132 describe '.mapping' do
133133
134134 it 'returns the default mapping by default' do
135- expect ( described_class . mapping ) . to eq described_class ::DEFAULT_MAPPING
135+ expect ( described_class . mapping ) . to eq described_class ::DEFAULT_ALIASES
136136 end
137137
138138 it 'can add a type' do
Original file line number Diff line number Diff line change @@ -1786,9 +1786,9 @@ class DiscriminatorChild2 < DiscriminatorParent
17861786 context '.type method' do
17871787 around do |example |
17881788 klass = Mongoid ::Fields ::FieldTypes
1789- klass . instance_variable_set ( :@mapping , klass ::DEFAULT_MAPPING . dup )
1789+ klass . instance_variable_set ( :@mapping , klass ::DEFAULT_ALIASES . dup )
17901790 example . run
1791- klass . instance_variable_set ( :@mapping , klass ::DEFAULT_MAPPING . dup )
1791+ klass . instance_variable_set ( :@mapping , klass ::DEFAULT_ALIASES . dup )
17921792 end
17931793
17941794 it 'can define a custom type' do
@@ -1838,7 +1838,7 @@ def self.model_name
18381838
18391839 describe '::TYPE_MAPPINGS' do
18401840 it 'returns the default mapping' do
1841- expect ( described_class ::TYPE_MAPPINGS ) . to eq ::Mongoid ::Fields ::FieldTypes ::DEFAULT_MAPPING
1841+ expect ( described_class ::TYPE_MAPPINGS ) . to eq ::Mongoid ::Fields ::FieldTypes ::DEFAULT_ALIASES
18421842 end
18431843 end
18441844end
You can’t perform that action at this time.
0 commit comments