diff --git a/lib/chewy/index.rb b/lib/chewy/index.rb index e46c167af..95cb8378d 100644 --- a/lib/chewy/index.rb +++ b/lib/chewy/index.rb @@ -30,12 +30,12 @@ class Index # def self.index_name(suggest = nil) if suggest - @index_name = build_index_name(suggest, prefix: prefix) + @index_name = build_index_name(suggest, prefix: default_prefix) else @index_name ||= begin build_index_name( name.sub(/Index\Z/, '').demodulize.underscore, - prefix: Chewy.configuration[:prefix] + prefix: default_prefix ) if name end end @@ -44,7 +44,7 @@ def self.index_name(suggest = nil) # Prefix to use # - def self.prefix + def self.default_prefix Chewy.configuration[:prefix] end diff --git a/spec/chewy/index_spec.rb b/spec/chewy/index_spec.rb index e2c7ef1c1..a03453351 100644 --- a/spec/chewy/index_spec.rb +++ b/spec/chewy/index_spec.rb @@ -68,9 +68,9 @@ end end - describe '.prefix' do + describe '.default_prefix' do before { allow(Chewy).to receive_messages(configuration: {prefix: 'testing'}) } - specify { expect(Class.new(Chewy::Index).prefix).to eq('testing') } + specify { expect(Class.new(Chewy::Index).default_prefix).to eq('testing') } end describe '.define_type' do