spec/spec_helper.rb in elasticsearch-model-7.2.1 vs spec/spec_helper.rb in elasticsearch-model-8.0.0.pre
- old
+ new
@@ -29,10 +29,14 @@
$stderr.puts("'mongoid' gem could not be loaded")
end
require 'yaml'
require 'active_record'
+# Load all of ActiveSupport to be sure of complete compatibility -
+# see https://github.com/elastic/elasticsearch-rails/pull/1075 for details
+require 'active_support/all'
+
unless defined?(ELASTICSEARCH_URL)
ELASTICSEARCH_URL = ENV['ELASTICSEARCH_URL'] || "localhost:#{(ENV['TEST_CLUSTER_PORT'] || 9200)}"
end
RSpec.configure do |config|
@@ -41,12 +45,15 @@
config.before(:suite) do
require 'ansi'
tracer = ::Logger.new(STDERR)
tracer.formatter = lambda { |s, d, p, m| "#{m.gsub(/^.*$/) { |n| ' ' + n }.ansi(:faint)}\n" }
- Elasticsearch::Model.client = Elasticsearch::Client.new host: ELASTICSEARCH_URL,
- tracer: (ENV['QUIET'] ? nil : tracer)
+ Elasticsearch::Model.client = Elasticsearch::Client.new(
+ host: ELASTICSEARCH_URL,
+ tracer: (ENV['QUIET'] ? nil : tracer),
+ transport_options: { :ssl => { verify: false } }
+ )
puts "Elasticsearch Version: #{Elasticsearch::Model.client.info['version']}"
unless ActiveRecord::Base.connected?
ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', :database => ":memory:" )
end
@@ -59,18 +66,9 @@
config.after(:all) do
drop_all_tables!
delete_all_indices!
end
-end
-
-# Is the ActiveRecord version at least 4.0?
-#
-# @return [ true, false ] Whether the ActiveRecord version is at least 4.0.
-#
-# @since 6.0.1
-def active_record_at_least_4?
- defined?(::ActiveRecord) && ::ActiveRecord::VERSION::MAJOR >= 4
end
# Delete all documents from the indices of the provided list of models.
#
# @param [ Array<ActiveRecord::Base> ] models The list of models.