File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ def inheritance_enabled
187
187
# Elasticsearch::Model.inheritance_enabled = true
188
188
#
189
189
def inheritance_enabled = ( inheritance_enabled )
190
- warn STI_DEPRECATION_WARNING
190
+ warn STI_DEPRECATION_WARNING if inheritance_enabled
191
191
@settings [ :inheritance_enabled ] = inheritance_enabled
192
192
end
193
193
Original file line number Diff line number Diff line change @@ -89,5 +89,30 @@ def self.search(query, options={})
89
89
expect ( Elasticsearch ::Model . settings [ :foo ] ) . to eq ( 'bar' )
90
90
end
91
91
end
92
+
93
+ context 'when \'inheritance_enabled\' is set' do
94
+
95
+ around do |example |
96
+ original_value = Elasticsearch ::Model . settings [ :inheritance_enabled ]
97
+ example . run
98
+ Elasticsearch ::Model . settings [ :inheritance_enabled ] = original_value
99
+ end
100
+
101
+ context 'when \'inheritance_enabled\' is true' do
102
+
103
+ it 'warns with a deprecation message' do
104
+ expect ( Elasticsearch ::Model ) . to receive ( :warn )
105
+ Elasticsearch ::Model . inheritance_enabled = true
106
+ end
107
+ end
108
+
109
+ context 'when \'inheritance_enabled\' is false' do
110
+
111
+ it 'does not warn' do
112
+ expect ( Elasticsearch ::Model ) . not_to receive ( :warn )
113
+ Elasticsearch ::Model . inheritance_enabled = false
114
+ end
115
+ end
116
+ end
92
117
end
93
118
end
You can’t perform that action at this time.
0 commit comments